The debug toolbar: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Paulhomebus
m (moved Enabling the debug toolbar to The debug toolbar: The debug toolbar is now automatically enabled on local development)
imported>Paulhomebus
Line 24: Line 24:
''
''


== How do I start using it? ==
== How can I turn it off? ==

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

# 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.''
''NOTE: Instructions are using vim - modify these instruction to use your favorite editor.''
Line 36: Line 30:
# vim mysite/settings.py
# vim mysite/settings.py


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


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


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

'''Now play with it and start hacking!'''

Revision as of 10:13, 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 can I turn it off?

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