Skip to content

Commit

Permalink
django-debug-toolbar - we pull it via requirements, so i added the ne…
Browse files Browse the repository at this point in the history
…cessary 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.
  • Loading branch information
ThomasWaldmann committed Dec 8, 2013
1 parent 088c53e commit 2516b48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions nsupdate/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
# 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',
Expand Down Expand Up @@ -170,6 +175,11 @@
'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.
Expand Down
6 changes: 4 additions & 2 deletions nsupdate/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ def __init__(self, *args, **kwargs):
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)),
)

0 comments on commit 2516b48

Please sign in to comment.