Django-debug-toolbar: Debug toolbar panel is almost always empty

Created on 22 Nov 2013  路  6Comments  路  Source: jazzband/django-debug-toolbar

Almost all of the time when I load my site the debug toolbar is empty like this:

http://imgur.com/fj49NHX

I have made the following configurations in my projects settings.py

DEBUG = True
TEMPLATE_DEBUG = DEBUG

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    )

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.webdesign',
    # Uncomment the next line to enable the admin:
     'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
     'django.contrib.admindocs',
     'django.contrib.humanize',
     'django.contrib.staticfiles',
     'watrbuzz',
     'watrworld',
     'accounts',
     'whregistration',
     'whprofiles',
     'analytical',
     'watrdata',
     'watrplace',
     'analytical',
     'debug_toolbar',
     'debug_toolbar_mongo',
)

INTERNAL_IPS = (
    '127.0.0.1', 
    'XX.XX.XXX.XXX',
)

DEBUG_TOOLBAR_PANELS = (
    'debug_toolbar.panels.version.VersionDebugPanel',
    'debug_toolbar.panels.timer.TimerDebugPanel',
    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
    'debug_toolbar.panels.headers.HeaderDebugPanel',
    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
    #'debug_toolbar.panels.sql.SQLDebugPanel',
    'debug_toolbar.panels.template.TemplateDebugPanel',
    'debug_toolbar.panels.cache.CacheDebugPanel',
    'debug_toolbar.panels.signals.SignalDebugPanel',
    'debug_toolbar.panels.logger.LoggingPanel',
    #'debug_toolbar.panels.redirects.InterceptRedirectsPanel',
    'debug_toolbar_mongo.panel.MongoDebugPanel',
)

def show_toolbar(request):
    return True


DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': False,
    #'SHOW_TOOLBAR_CALLBACK': show_toolbar,
    # 'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
    #'HIDE_DJANGO_SQL': False,
    'TAG': 'div',
    'DEBUG_TOOLBAR_MEDIA_ROOT' : ' /usr/lib/python2.7/site-packages/debug_toolbar/', 
    'RENDER_PANELS' : True
    }

I do see the panels populated if I force my webapp to display a traceback. The pages are in HTML and they have the requisite <html></html> <body></body> tags.

Most helpful comment

Yes, I've just updated the docs to remind readers that blindly copy-pasting stuff without attempting to understand it is likely to yield sub-par results.

All 6 comments

This is quite hard to diagnose remotely on a full-blown project. You'll have to reduce the problem to a minimal test case before I can really help you.

Does the problem still occur if you remove the DEBUG_TOOLBAR_PANELS and DEBUG_TOOLBAR_CONFIG settings and you also remove debug_toolbar_mongo from INSTALLED_APPS?

If it doesn't, can you re-add the settings you really need one by one until you find which one triggers the issue?

In fact I suspect that 'TAG': 'div', is incorrect in your configuration.

Please reopen if you can reduced this to a more specific problem in the debug toolbar.

Same Problem

http://snag.gy/FCYng.jpg

MIDDLEWARE_CLASSES = (
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

INTERNAL_IPS = ('127.0.0.1', 'XXX.XXX.XXX.XXX',)

INSTALLED_APPS += (
    'debug_toolbar',
)


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.templates.TemplatesPanel',
    'debug_toolbar.panels.cache.CachePanel',
    'debug_toolbar.panels.signals.SignalsPanel',
    'debug_toolbar.panels.logging.LoggingPanel',
    'debug_toolbar.panels.redirects.RedirectsPanel',
    'debug_toolbar.panels.profiling.ProfilingPanel',
]

def custom_show_toolbar(request):
    return True  # Always show toolbar, for example purposes only.

DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': True,
    'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
    'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
    'HIDE_DJANGO_SQL': False,
    'TAG': 'div',
    'ENABLE_STACKTRACES': True,
    'HIDE_IN_STACKTRACES': ('gunicorn', 'newrelic'),
}

Django 1.6

Are you sure the values in DEBUG_TOOLBAR_CONFIG make sense for your project?

What happens if you remove DEBUG_TOOLBAR_CONFIG entirely? I'm pretty sure the defaults will work better than this configuration.

I have removed part of the settings and now it works, but it should make that clear in the documentation

MIDDLEWARE_CLASSES = (
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

INTERNAL_IPS = ('127.0.0.1', 'XXX.XXX.XXX.XXX',)

INSTALLED_APPS += (
    'debug_toolbar',
)

# 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.templates.TemplatesPanel',
#     'debug_toolbar.panels.cache.CachePanel',
#     'debug_toolbar.panels.signals.SignalsPanel',
#     'debug_toolbar.panels.logging.LoggingPanel',
#     'debug_toolbar.panels.redirects.RedirectsPanel',
#     'debug_toolbar.panels.profiling.ProfilingPanel',
# ]

# def custom_show_toolbar(request):
#     return True  # Always show toolbar, for example purposes only.

# DEBUG_TOOLBAR_CONFIG = {
#     'INTERCEPT_REDIRECTS': True,
#     'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
#     'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
#     'HIDE_DJANGO_SQL': False,
#     'TAG': 'div',
#     'ENABLE_STACKTRACES': True,
#     'HIDE_IN_STACKTRACES': ('gunicorn', 'newrelic'),
# }

Thanks

Yes, I've just updated the docs to remind readers that blindly copy-pasting stuff without attempting to understand it is likely to yield sub-par results.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stfenjobs picture stfenjobs  路  6Comments

Arlington1985 picture Arlington1985  路  5Comments

mangobowl picture mangobowl  路  11Comments

pawamoy picture pawamoy  路  5Comments

pstreck picture pstreck  路  6Comments