Last active
December 15, 2018 23:38
-
-
Save diek/796012c2f7ba2868fe462fde33c6378e to your computer and use it in GitHub Desktop.
Django Debug Toolbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install django-debug-toolbar | |
# Debug toolbar | |
Add to settings.py | |
def show_toolbar(request): | |
return True | |
DEBUG_TOOLBAR_CONFIG = { | |
"SHOW_TOOLBAR_CALLBACK": show_toolbar, | |
} | |
INTERNAL_IPS = ('127.0.0.1') | |
apps => ‘debug_toolbar', | |
MIDDLEWARE_CLASSES = [ | |
'debug_toolbar.middleware.DebugToolbarMiddleware', | |
project urls.py | |
from django.conf import settings | |
from django.urls import include, path | |
# Put after urlpatterns | |
if settings.DEBUG: | |
import debug_toolbar | |
urlpatterns = [ | |
path('__debug__/', include(debug_toolbar.urls)), | |
] + urlpatterns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment