This page looks best with JavaScript enabled

Django Debug Toolbar

 ·  ๐ŸŽƒ kr0m

Django Debug Toolbar is a set of panels that display debug information about requests made in the web application, such as used versions, HTTP headers, response times, received signals, cache usage, templates used, analysis of queries made to the database, among other useful information.

Before starting, it is recommended to read the previous articles about Django since they are the previous steps to this article:

Activate the project’s venv:

cd rxWod
source bin/activate
cd rxWodProject/

Install the toolbar:

pip install django-debug-toolbar

Make sure to have the ‘django.contrib.staticfiles’ App and add the ‘debugtoolbar’ App, also we must have the STATICURL variable configured:

vi rxWodProject/

    # ...

STATIC_URL = '/static/'

Enable the toolbar middleware, as mentioned in the documentation the order is important:

The order of MIDDLEWARE is important. You should include the Debug Toolbar middleware as early as possible in the list. However, it must come after any other middleware that encodes the responseโ€™s content, such as GZipMiddleware.

vi rxWodProject/

Enable access to the toolbar from localhost:

vi rxWodProject/


Add an extra URL:

vi rxWodProject/

import debug_toolbar

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

urlpatterns = [
    path('', include('rxWod.urls')),
    path('', include('usersAuth.urls')),
    path('__debug__/', include(debug_toolbar.urls)),

Start the server:

python runserver

Access our App:

We can see a sidebar with information about SQL queries among other useful information.

The queries in detail are shown as follows:

If you liked the article, you can treat me to a RedBull here