The debug toolbar: Difference between revisions

From OpenHatch wiki
imported>Paulhomebus
imported>Paulhomebus
m (moved Enabling the debug toolbar to The debug toolbar: The debug toolbar is now automatically enabled on local development)
(No difference)

Revision as of 10:10, 28 March 2011

What is the debug_toolbar?

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?

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 do I start using it?

These instructions are the quick and easy way to get this working on any machine that has the module [easy_install] - [2] for python which is part of setuptools.

  1. easy_install django-debug-toolbar

once that's done edit mysite/settings.py

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 uncomment it ( /debug_toolbar # finds the spot to uncomment #'debug_toolbar',)

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

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

Now play with it and start hacking!