Django and Oscar

Django Debug Toolbar

Published 2021-02-12. Last modified 2021-03-27.
Time to read: 1 minutes.

This page is part of the django collection.

Django Debug Toolbar

The Django Debug Toolbar is a very useful tool, and is easy to set up. This is a good video on YouTube about installing Django Debug Toolbar.

The Django Debug Toolbar is only needed for development, so it should be installed after separate settings for dev have been established.

I put the Django Debug Toolbar settings in settings/ Below is my complete settings/ for Frobshop; the only line not associated with Django Debug Toolbar is the one starting with EMAIL_BACKEND:

from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
INSTALLED_APPS += [ 'debug_toolbar', ]
INTERNAL_IPS = [ '', ]
MIDDLEWARE += [ 'debug_toolbar.middleware.DebugToolbarMiddleware', ]

The only other changes required in order for the Django Debug Toolbar to operate are:

  1. Add the following to
    import debug_toolbar
    urlpatterns = [ path('__debug__/', include(debug_toolbar.urls)), ]
  2. Add the .dev qualifier to frobshop.settings in
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', '')

Now install Django Debug Toolbar and update requirements.txt:

(aw) $ python -m pip install django-debug-toolbar
(aw) $ pip freeze > requirements.txt

* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.