Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.