Skip to content

Instantly share code, notes, and snippets.

@diek
Last active December 15, 2018 23:38
Show Gist options
  • Save diek/796012c2f7ba2868fe462fde33c6378e to your computer and use it in GitHub Desktop.
Save diek/796012c2f7ba2868fe462fde33c6378e to your computer and use it in GitHub Desktop.
Django Debug Toolbar
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