Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wolph
Created September 24, 2019 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolph/87eb0fdbced45956c3f8dba1b3e0c494 to your computer and use it in GitHub Desktop.
Save wolph/87eb0fdbced45956c3f8dba1b3e0c494 to your computer and use it in GitHub Desktop.
DEBUG_TOOLBAR = DEBUG
if DEBUG_TOOLBAR:
def show_toolbar(request):
if request.user.is_superuser:
return True
elif request.META['REMOTE_ADDR'] in INTERNAL_IPS:
return True
return False
INSTALLED_APPS += [
'debug_toolbar',
]
for i, m in enumerate(MIDDLEWARE):
if 'wagtail' in m.lower():
MIDDLEWARE.insert(
i, 'debug_toolbar.middleware.DebugToolbarMiddleware')
break
DEBUG_TOOLBAR_CONFIG = dict(
SHOW_TOOLBAR_CALLBACK=show_toolbar,
JQUERY_URL='',
)
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
DEBUG_TOOLBAR_CONFIG = dict(
DISABLE_PANELS={
'debug_toolbar.panels.redirects.RedirectsPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.cache.CachePanel',
},
HIDE_IN_STACKTRACES={
'debug_toolbar',
'django',
'gunicorn',
'socketserver',
'threading',
'wsgiref',
'jinja2',
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment