New Wagtail Course! 🥳 The Ultimate Wagtail Developers Course

Tutorial Wagtail Version: 2.x

Installing Django Debug Toolbar

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 to install Django Debug Toolbar.

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 INSTALLED_APPS = INSTALLED_APPS + [ 'debug_toolbar', ] MIDDLEWARE = MIDDLEWARE + [ 'debug_toolbar.middleware.DebugToolbarMiddleware', ] INTERNAL_IPS = ("127.0.0.1", "172.17.0.1") # 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.

Related tutorials

Upgrading Wagtail (to 2.5.1), Django (to 2.2.2) and Django Debug Toolbar

Posted on

In this video we'll go over upgrading your Wagtail website from v2.4 to v2.5.1 and we'll upgrade Django from 2.1.5 to 2.2.2. As a bonus, we'll explore an issue with Django Debug Toolbar.

View lesson, Upgrading Wagtail (to 2.5.1), Django (to 2.2.2) and Django Debug Toolbar

Installing Wagtail using Venv

Posted on

This is a clip from the Wagtail for Beginners course. Learn how to setup a brand new Wagtail project using pure Python. No Docker, no virtualenv, no Pipenv, nothing fancy. We'll use Pythons built in venv command.

View lesson, Installing Wagtail using Venv

Registering Snippets using Django Models

Posted on

Snippets are Wagtails way of re-using existing data. For example, being able to select a Blog Author (or multiple authors) instead of having to add a name, image and website for every blog author in every blog post you make; instead you can simply fill out a form once, and re-use the final data with a couple of clicks.

View lesson, Registering Snippets using Django Models

Setting up Django Shell, Shell Plus and IPython

Posted on

Django comes with a python shell where you can import your models and test things out. It's not great out of the box, but we can make it better by using shell_plus (installation instructions are inside) and letting IPython take care of interactivity. This is all helpful for learning Wagtail.

View lesson, Setting up Django Shell, Shell Plus and IPython

The Ultimate Wagtail Developers Course

This course covers everything from basic installation to advanced features like custom blocks and API integration, it's perfect for developers looking to enhance their skills with this powerful CMS.

Ultimate Wagtail Developers Course Logo