Tutorial Summary

Learn how to add one of the most useful Django debugging tools into your new Wagtail project. We'll go through the installation docs, learn how base.py, dev.py and production.py work together, and how

In this lesson we're going to learn what Django Debug Toolbar is, how it can help, what it gives us, and how to install it.

This is one of the most useful packages I use on a daily basis for building larger Django and Wagtail CMS application. Over the last couple years I've even caught some packages that have over 1200 SQL queries on a page load. In production it didn't seem like an issue because of the large server, but in development the site was taking over 80 seconds to load. Django Debug Toolbar helped me pinpoint the problem.

Whenever I'm working on a larger application that has a lot of included template file and I can't seem to find the right one, I just open Django Debug Toolbar and it'll list all the template files (and includes/partials) so I can narrow down my search.

This video will go over installation and how to make this package work for you. But if you want to learn more, you can also check out their docs at django-debug-toolbar.readthedocs.io

Installation Guide

Videos not your thing? That's OK, I got you covered. Below are the steps to installing Django Debug Toolbar on your development Wagtail CMS site.

$ pip install django-debug-toolbar

# dev.py; add these lines


INTERNAL_IPS = ("", "")

# urls.py; add these lines
from django.urls import path

if settings.DEBUG:
    import debug_toolbar
    urlpatterns = [
        path('__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns
View the Changes in GitHub

Here is the link to the commit and you can see the code changes, line-by-line. View it on GitHub.

Sign up for our newsletter

Get notified about new lessons :)

Our Sites