当我加载我的站点时,几乎所有时间调试工具栏都是空的,如下所示:
我在我的项目 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
}
如果我强制我的 web 应用程序显示回溯,我确实会看到面板已填充。这些页面采用 HTML 格式,并且具有必要的<html></html> <body></body>
标签。