Django - Add Debug Toolbar

Steps to add Debug Toolbar to a Django project

This page explains how to add Django Debug Toolbar to an existing Django project. For newcomers, the Django Debug Toolbar is a configurable set of panels that bumps various information about the current request/response when clicked.

How to install

Step #1 - Add django-debug-toolbar to project dependencies or install via PIP

# File: requirements.txt
...
django-debug-toolbar
...

Or install via PIP

pip install django-debug-toolbar

Step #2 - Update project routes

# File core/urls.py

import debug_toolbar   # <-- NEW                     

from django.contrib import admin
from django.urls import path, include  

urlpatterns = [
    path('admin/', admin.site.urls),          
    
    path('__debug__/', include(debug_toolbar.urls)),  # <-- NEW
    
    path("", include("authentication.urls")), 
    path("", include("app.urls"))             
]

Step #3 - Update Settings

Step #4 - Execute the migration

Step #5 - Start the app (the debug toolbar should be visible)

At this point, the Debug Toolbar should be visible on the right side for all pages.

Django Debug Toolbar - Soft UI Dashboard.

Resources

Last updated

Was this helpful?