Setting up Django Debug Toolbar

Django Debug Toolbar is a very useful piece of django middleware which gives you a side panel displaying useful information about your app, including requests and sql queries.

As with any new piece of software in the hands of a novice, I had a few teething problems setting the toolbar up on my local machine. To remind me and to help others, I have distilled my morning’s work into the following succinct steps:

  1. Install django-debug-toolbar. I used
    $ sudo easy_install django_debug_toolbar

    though there are various methods. Just make sure the package ends up on your python path.

  2. Now we add the package to the MIDDLEWARE_CLASSES in your project

    The debug toolbar should be after any other middleware that encodes the response content, so it is best to place it last in the middleware sequence.

  3. We also add the package to  INSTALLED_APPS in the project
  4. Finally, make sure that the following appears in the project
    INTERNAL_IPS = ('')
  5. Now fire up your project, and all being well, the django debug side panel should appear in the browser window. If this does not happen, the first thing to check is whether you have <body></body> tags in your html. If you switch to your project admin and the debug toolbar appears, this is most likely to be the issue. Other things to check are that the debug toolbar package is installed and on the python path:
    >>> import sys
    >>> print sys.path
Useful links:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s