{"id":1454,"library":"django-debug-toolbar","title":"Django Debug Toolbar","description":"Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response in Django applications. It is actively maintained by the Django Commons organization, with new releases typically coming out every few months, often tied to Django's release cycle and Python version support. The current version is 6.3.0.","status":"active","version":"6.3.0","language":"python","source_language":"en","source_url":"https://github.com/django-commons/django-debug-toolbar","tags":["django","debugging","development","profiling","web"],"install":[{"cmd":"pip install django-debug-toolbar","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for the debug toolbar to function. Requires Django 4.2+ for current versions, compatible with Python >=3.10.","package":"Django","optional":false}],"imports":[{"wrong":"from debug_toolbar.middleware import DebugToolbarMiddleware","symbol":"DebugToolbarMiddleware","correct":"from debug_toolbar.middleware import DebugToolbarMiddleware"}],"quickstart":{"code":"# settings.py\nimport os\n\nDEBUG = True # Essential for debug_toolbar to appear\n\nINSTALLED_APPS = [\n    # ... your other apps\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \n    \"debug_toolbar\", # Add debug_toolbar to your INSTALLED_APPS\n]\n\nMIDDLEWARE = [\n    # ... Django's default middleware ...\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"debug_toolbar.middleware.DebugToolbarMiddleware\", # Place early in middleware list\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n    # ... your custom middleware ...\n]\n\n# Configure INTERNAL_IPS for the toolbar to show up\nINTERNAL_IPS = [\n    \"127.0.0.1\",\n    \"::1\", # IPv6 localhost\n    # If running in Docker, WSL, or remotely, add your development machine's IP, e.g.,\n    # \"172.17.0.1\", # Common for Docker host\n    # os.environ.get(\"YOUR_DEV_IP\", \"\"), # Dynamic IP example\n]\n\n# Optional: Customize toolbar behavior (e.g., disable panels)\nDEBUG_TOOLBAR_CONFIG = {\n    \"DISABLE_PANELS\": [\n        \"debug_toolbar.panels.redirects.RedirectsPanel\" # Example: disable redirects panel\n    ],\n    \"SHOW_TOOLBAR_CALLBACK\": \"debug_toolbar.utils.show_toolbar_callback\",\n}\n\n\n# urls.py\nfrom django.contrib import admin\nfrom django.urls import path, include\nfrom django.conf import settings\n\nif settings.DEBUG:\n    import debug_toolbar # Only import if DEBUG is True\n    urlpatterns = [\n        path(\"__debug__/\", include(debug_toolbar.urls)),\n        path(\"admin/\", admin.site.urls),\n        # ... your other app paths ...\n    ]\nelse:\n    urlpatterns = [\n        path(\"admin/\", admin.site.urls),\n        # ... your other app paths ...\n    ]\n","lang":"python","description":"To quickly set up Django Debug Toolbar, first install the package. Then, modify your Django project's `settings.py` by adding `'debug_toolbar'` to `INSTALLED_APPS` and `'debug_toolbar.middleware.DebugToolbarMiddleware'` to `MIDDLEWARE`. Crucially, configure `INTERNAL_IPS` to include your development machine's IP address(es) for the toolbar to be visible. Finally, add the debug toolbar's URLs to your project's `urls.py`, typically conditional on `settings.DEBUG` being `True`."},"warnings":[{"fix":"Review any custom panels and update logic for data storage according to the new panel data persistence system. Be aware of automatic sanitization of sensitive data in displayed information.","message":"Version 6.0.0 significantly revamped how panel data is persisted, introducing configurable backends (memory, database). Custom panels or previous assumptions about panel data handling may require updates. Additionally, sensitive information is now filtered using `SafeExceptionReporterFilter.cleanse_setting()`.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Ensure your project runs on Python 3.9+ (preferably 3.10+ for current versions of Django). Thoroughly test your middleware chain and async views after upgrading.","message":"Version 5.0.0 dropped support for Python 3.8. The project moved to the Django Commons organization. Significant changes were made to the middleware for improved async compatibility, which might affect highly customized middleware setups or existing async applications.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Add `INTERNAL_IPS = ['127.0.0.1', '::1', 'your_dev_ip_here']` to your `settings.py`. For dynamic environments, consider using environment variables to populate this list.","message":"The `INTERNAL_IPS` setting is mandatory for the toolbar to appear. By default, the toolbar only shows for requests originating from these specified IP addresses. If you're using Docker, WSL, a remote development environment, or a non-standard localhost setup, you must ensure your client's IP is included.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Place `'debug_toolbar.middleware.DebugToolbarMiddleware'` early in your `MIDDLEWARE` list, typically after `SecurityMiddleware` and `SessionMiddleware` but before other processing middleware like `CommonMiddleware`.","message":"The placement of `DebugToolbarMiddleware` in your `MIDDLEWARE` list is crucial. It generally needs to be placed *after* any middleware that modifies the response (e.g., `CompressionMiddleware`, `CommonMiddleware`) but *before* middleware that expects a complete response and may prematurely close it.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Replace `'debug_toolbar.panels.redirects.RedirectsPanel'` with `'debug_toolbar.panels.history.HistoryPanel'` in your `DEBUG_TOOLBAR_PANELS` setting if you have customized your panel list.","message":"As of version 6.2.0, `RedirectsPanel` has been deprecated in favor of the more robust `HistoryPanel`. While `RedirectsPanel` still functions, it is recommended to update your `DEBUG_TOOLBAR_PANELS` setting if you explicitly listed it.","severity":"deprecated","affected_versions":">=6.2.0"},{"fix":"Ensure `DEBUG = True` in your development `settings.py` file. Use separate settings files or environment variables to manage `DEBUG` for different environments.","message":"The Django `DEBUG` setting must be set to `True` for the toolbar to activate and display. The toolbar will not render in production environments where `DEBUG` is `False`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the `DJANGO_SETTINGS_MODULE` environment variable is set to your project's settings file (e.g., `your_project.settings`), or that `settings.configure()` is called at an appropriate point in your application's bootstrap process.","message":"The Django settings module must be configured before any settings, including those for django-debug-toolbar, can be accessed. This typically involves defining the `DJANGO_SETTINGS_MODULE` environment variable or calling `settings.configure()` in your application setup.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the `DJANGO_SETTINGS_MODULE` environment variable is correctly set to your project's settings module path (e.g., `export DJANGO_SETTINGS_MODULE=myproject.settings`) or ensure `django.conf.settings.configure()` is called appropriately during application initialization.","message":"Django requires a settings module to be configured before any settings can be accessed. This is typically achieved by setting the `DJANGO_SETTINGS_MODULE` environment variable (e.g., `myproject.settings`) or by explicitly calling `django.conf.settings.configure()` in your application's bootstrap. Without configured settings, the Django application, including the debug toolbar, cannot function.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'6.3.0':58 'activ':27 'applic':24 'come':38 'common':32 'configur':9 'current':20,55 'cycl':49 'debug':2,5,16,60 'develop':61 'display':14 'django':1,4,23,31,46,59 'everi':40 'inform':17 'maintain':28 'month':42 'new':35 'often':43 'organ':33 'panel':12 'profil':62 'python':51 'releas':36,48 'request/response':21 'set':10 'support':53 'tie':44 'toolbar':3,6 'typic':37 'various':15 'version':52,56 'web':63","created_at":"2026-04-09T03:48:37.793522+00:00","updated_at":"2026-04-16T14:29:49.974650+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpvdccrptm/venv/lib/python3.12/site-packages/debug_toolbar/middleware.py\", line 22, in <module>\n    from debug_toolbar.panels import Panel\n  File \"/tmp/tmpvdccrptm/venv/lib/python3.12/site-packages/debug_toolbar/"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"7.1.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/django-commons/django-debug-toolbar","docs":"https://django-debug-toolbar.readthedocs.io/","changelog":"https://django-debug-toolbar.readthedocs.io/en/latest/changes.html","pypi":"https://pypi.org/project/django-debug-toolbar/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-27","next_check":"2026-07-10","install_tag":"stale"}}