The debug toolbar

From OpenHatch wiki
Jump to navigation Jump to search

This is a page about improving or modifying OpenHatch.

We call that "Hacking OpenHatch," and there is a whole category of pages about that.

What is the debug_toolbar?[edit]

The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content.

Currently, the following panels have been written and are working:

             1. Django version
             2. Request timer
             3. A list of settings in settings.py
             4. Common HTTP headers
             5. GET/POST/cookie/session variable display
             6. Templates and context used, and their template paths
             7. SQL queries including time to execute and links to EXPLAIN each query
             8. List of signals, their args and receivers
             9. Logging output via Python's built-in logging module

There is also one Django management command currently: debugsqlshell: Outputs the SQL that gets executed as you work in the Python interactive shell.

Why should I use it?[edit]

I think people who are noob OH / Django hackers will appreciate the benefits of using the [debug_toolbar] - [1] on their local OH development platform.

How can I turn it off?[edit]

NOTE: Instructions are using vim - modify these instruction to use your favorite editor.

  1. vim mysite/settings.py

Look under INSTALLED_APPS and find the commented line 'debug_toolbar', and comment it ( /debug_toolbar # finds the spot to comment #'debug_toolbar',)

Look under MIDDLEWARE_CLASSES and find the line 'debug_toolbar.middleware.DebugToolbarMiddleware', comment it also. ( /debug/n # finds the spot to comment #'debug_toolbar.middleware.DebugToolbarMiddleware', )

That's it - restart your OH development server. ./bin/mysite runserver