'Debug Toolbar not showing
- I installed: pip install django-debug-toolbar
- I have DEBUG=True in my settings
- I have django.contrib.staticfiles and debug_toolbar in INSTALLED_APPS
- i have STATIC_URL = '/static/' in STATIC_URL
- I have 'debug_toolbar.middleware.DebugToolbarMiddleware' high up in MIDDLEWARE_CLASSES
- I have INTERNAL_IPS = ['127.0.0.1'] in my settings
- I have urlpatterns = [ ... path('debug/', include(debug_toolbar.urls)) ] and Import debug_toolbar in URLConfig of project.
- I have run python manage.py collectstatic and Debug Toolbar not showing in my browser How can I fix it?
Solution 1:[1]
Have you included this setting in settings.py
#settings.py
DEBUG_TOOLBAR_CONFIG = {
"DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"],
"SHOW_TEMPLATE_CONTEXT": True,
"SHOW_TOOLBAR_CALLBACK": "app_name.small_utils.show_toolbar_callback", # this is the location of the function show_toolbar_callback
}
#app_name/small_utils.py
def show_toolbar_callback(request):
return not request.is_ajax() and request.user and request.user.is_superuser
After setting this your debug toolbar will start working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Deepak Tripathi |
