django-debug-toolbar - we pull it via requirements, so i added the necessary settings so it can work

maybe the more simple "quick setup" (see ddt docs) would also have worked, if I had found out earlier
that INTERNAL_IPS is a required setting.
This commit is contained in:
Thomas Waldmann 2013-12-08 14:42:58 +01:00
parent 088c53e78b
commit 2516b48c88
2 changed files with 14 additions and 2 deletions

View File

@ -131,6 +131,11 @@ MIDDLEWARE_CLASSES = (
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
if DEBUG:
MIDDLEWARE_CLASSES = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
) + MIDDLEWARE_CLASSES
INTERNAL_IPS = ['127.0.0.1', '::1', ] # needed for DebugToolbar!
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.request',
@ -170,6 +175,11 @@ INSTALLED_APPS = (
'registration',
'django_extensions',
)
if DEBUG:
DEBUG_TOOLBAR_PATCH_SETTINGS = False
INSTALLED_APPS += (
'debug_toolbar',
)
# A sample logging configuration.
# Sends an email to the site admins on every HTTP 500 error when DEBUG=False.

View File

@ -67,8 +67,10 @@ urlpatterns = patterns(
url(r'^', include('nsupdate.main.urls')),
)
from django.conf import settings
if settings.DEBUG:
urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'), )
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)