over 8 years ago

Just found a great tool for debugging Django applications, the Django debug toolbar provides a toolbar to your webpage when DEBUG=True. It looks like this:


The toolbar will provides a ton of information, such as:

  • The number of database queries made while loading the apge
  • The amount of time it took to load the page (similar to Chrome dev tools' Timeline feature)
  • The content of your Settings file
  • Content of the request and response headers
  • The name and page of each static files loaded along with the current page
  • Current page's template name and path
  • If Caching is used, it shows the content of the cached objects and the time it took to load them
  • Singals
  • Logging messages
  • Redirects

To install it:

pip install django-debug-toolbar

Then, in your settings.py:

    'django.contrib.staticfiles',  # <- automatically added by Django, make sure it is not missing
    'debug_toolbar',                             # <- add this
    'myapp',                                           # <- your app 

# static url has to be defined
STATIC_URL = '/static/'

# pick and choose the panels you want to see

That's it. Start your server by

python manage.py runser

Load up your page in the web browser, you should see a black vertical toolbar appearing on the right side of your page.

← Browse sqlite DB Populate Jasny's Bootstrap image upload plugin →
comments powered by Disqus