It seems that the latest Django debug toolbar module has changed to middleware now and requires explicit URL setup to work. With my Django projects I always try to keep settings organised based on environment and not have if settings.DEBUG
littered all over the settings files and project.
My settings layout is a general:
common.py (everything in here)
development.py (dev only things here)
production.py (prod only things here)
Is there a way in Django 1.10 I can add to the URLs in the development.py file so that I can keep away from if settings.DEBUG
. Or will we be forced to use this method if wanting to use the new version of the debug toolbar?
I just find the below a bit of an anti-pattern
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]