Skip to content

How to Fix Python Django Debug Toolbar Not Showing

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix Python Django Debug Toolbar Not Showing. We cover key concepts, practical examples, and best practices.

Django Debug Toolbar does not appear in the browser when INTERNAL_IPS is not set correctly, the middleware is misordered, or the toolbar template is not loaded.

The Wrong Way

# settings.py
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myapp',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

INTERNAL_IPS = ['127.0.0.1']

The toolbar does not appear on any page.

The Right Way

# settings.py
INSTALLED_APPS = [
    'debug_toolbar',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myapp',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

INTERNAL_IPS = ['127.0.0.1']

# urls.py
from django.urls import include, path

if settings.DEBUG:
    urlpatterns += [
        path('__debug__/', include('debug_toolbar.urls')),
    ]

The toolbar now appears on every page.

Prevention Tips

  • Add debug_toolbar as the first item in INSTALLED_APPS.
  • Insert DebugToolbarMiddleware as early as possible in MIDDLEWARE.
  • Set INTERNAL_IPS correctly for your development IP.
  • Use SHOW_TOOLBAR_CALLBACK if you use Docker or Vagrant.
  • Disable the toolbar in production by checking DEBUG in URL config.

Common Mistakes with django debug toolbar

  1. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  2. Using return to exit a function early instead of wrapping a pure value in the monad
  3. Mixing let bindings with <- bindings in do notation, producing type errors

These mistakes appear frequently in real-world PYTHON code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does Debug Toolbar not show with Docker?

Inside Docker, INTERNAL_IPS must match the Docker host IP, not 127.0.0.1. Use SHOW_TOOLBAR_CALLBACK instead of INTERNAL_IPS: def show_toolbar(request): return True during development.

Can I customize which panels appear in the toolbar?

Yes, set DEBUG_TOOLBAR_PANELS in settings to a list of panel paths. Remove panels you do not need, like RequestPanel or StaticFilesPanel, to reduce overhead.

How do I see SQL queries for AJAX requests?

Enable DEBUG_TOOLBAR_CONFIG['SHOW_TOOLBAR_CALLBACK'] to return True for AJAX requests. The toolbar adds a djdt cookie that lets you browse SQL queries for AJAX requests via the toolbar's history panel.

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro