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.
pip install django-debug-toolbarVerified import paths — ran on the pinned version, not inferred.
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`.
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.
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.
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.
Place `'debug_toolbar.middleware.DebugToolbarMiddleware'` early in your `MIDDLEWARE` list, typically after `SecurityMiddleware` and `SessionMiddleware` but before other processing middleware like `CommonMiddleware`.
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.
Ensure `DEBUG = True` in your development `settings.py` file. Use separate settings files or environment variables to manage `DEBUG` for different environments.
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.
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.