Django Debug Toolbar
Development debugging panel for Django — adds a collapsible sidebar to HTML pages showing request details, SQL queries, template rendering, cache hits, signal execution, and profiling. Django Debug Toolbar panels: SQL (all queries with EXPLAIN, duplicate detection), Time (per-phase timing), Cache (hits/misses), Signals (fired signals with receivers), Templates (context variables, template path), Headers (request/response headers), History (recent requests), Static Files, Redirects, Logging, and Profiling (call graph). SHOW_TOOLBAR_CALLBACK restricts to staff users. Catches N+1 queries and slow agent request SQL automatically in development.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
CRITICAL: Debug Toolbar exposes SQL queries, headers, cache keys, and context — restrict to development ONLY. Never enable in production agent deployments. SHOW_TOOLBAR_CALLBACK must verify DEBUG=True and staff status for any staging use. Toolbar sidebar injected into HTML can expose agent data to browser dev tools.
⚡ Reliability
Best When
Every Django agent development environment — Debug Toolbar shows SQL queries, slow operations, and N+1 problems in the browser without adding print() statements or running separate profilers.
Avoid When
Production environments (performance overhead + security exposure), non-HTML API-only agent backends, or load testing scenarios.
Not For
- • Production monitoring — Debug Toolbar is development-only; for production agent performance monitoring use Prometheus + Grafana, DataDog APM, or New Relic
- • Non-HTML API endpoints — Debug Toolbar only injects into HTML responses; for agent REST API JSON endpoint profiling use Django Silk or cProfile middleware
- • Load testing profiling — Debug Toolbar processes each request synchronously adding overhead; for agent load test profiling use py-spy or dedicated APM
Interface
Authentication
SHOW_TOOLBAR_CALLBACK controls display. Default shows only for staff users or DEBUG=True with internal IPs. Never enable in production without proper auth restriction.
Pricing
Django Debug Toolbar is BSD-3-Clause licensed, maintained by Jazzband. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ INTERNAL_IPS must include Docker host IP — default INTERNAL_IPS=['127.0.0.1'] works for local dev; Docker-based agent dev environments have different IP (172.17.0.1 typical); add IP dynamically: import socket; hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()); INTERNAL_IPS = [ip[:-1]+'1' for ip in ips]; toolbar silently doesn't show without matching IP
- ⚠ debug_toolbar.middleware.DebugToolbarMiddleware must be first — if gzip or other compression middleware comes before debug toolbar, HTML injection of toolbar sidebar fails; agent projects with WhiteNoise or GZipMiddleware before DebugToolbarMiddleware get no toolbar sidebar in HTML responses
- ⚠ Not shown for AJAX/JSON responses — Debug Toolbar injects JavaScript sidebar into HTML responses only; agent REST API views returning JSON don't show toolbar; to debug agent API SQL use logging.getLogger('django.db.backends') or django-silk for JSON endpoint profiling
- ⚠ Toolbar in production is a security vulnerability — SHOW_TOOLBAR_CALLBACK returning True in production exposes all agent SQL queries, request headers (including auth tokens), cache keys, and template context to anyone; misconfigured production toolbar leaks sensitive agent infrastructure details; always check DEBUG=False disables toolbar
- ⚠ Historical panel requires ENABLE_STACKTRACES — SQL panel stacktraces showing which agent code triggered query require DEBUG_TOOLBAR_CONFIG = {'ENABLE_STACKTRACES': True}; disabled by default for performance; enable for agent N+1 query investigation to see exact code line generating duplicate SQL
- ⚠ Panel not appearing with async views — Debug Toolbar 4.x has limited async support; Django async views (async def my_view) may not display all panels correctly; agent async DRF views or async Django views show incomplete SQL panel; use sync agent views or django-silk for async endpoint SQL profiling
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Django Debug Toolbar.
Scores are editorial opinions as of 2026-03-06.