Commit 7a7a867e by Ned Batchelder

Fix Django Debug Toolbar circular imports

There's an "explicit" way to configure Django Debug Toolbar that isn't
prone to circular import errors:

http://django-debug-toolbar.readthedocs.org/en/1.0/installation.html#explicit-setup

Do that.
parent 69646900
...@@ -595,6 +595,15 @@ REQUIRE_EXCLUDE = ("build.txt",) ...@@ -595,6 +595,15 @@ REQUIRE_EXCLUDE = ("build.txt",)
# It can also be a path to a custom class that subclasses require.environments.Environment and defines some "args" function that returns a list with the command arguments to execute. # It can also be a path to a custom class that subclasses require.environments.Environment and defines some "args" function that returns a list with the command arguments to execute.
REQUIRE_ENVIRONMENT = "node" REQUIRE_ENVIRONMENT = "node"
########################## DJANGO DEBUG TOOLBAR ###############################
# We don't enable Django Debug Toolbar universally, but whenever we do, we want
# to avoid patching settings. Patched settings can cause circular import
# problems: http://django-debug-toolbar.readthedocs.org/en/1.0/installation.html#explicit-setup
DEBUG_TOOLBAR_PATCH_SETTINGS = False
################################# TENDER ###################################### ################################# TENDER ######################################
# If you want to enable Tender integration (http://tenderapp.com/), # If you want to enable Tender integration (http://tenderapp.com/),
......
...@@ -190,6 +190,11 @@ if settings.DEBUG: ...@@ -190,6 +190,11 @@ if settings.DEBUG:
except ImportError: except ImportError:
pass pass
import debug_toolbar
urlpatterns += (
url(r'^__debug__/', include(debug_toolbar.urls)),
)
# Custom error pages # Custom error pages
# pylint: disable=invalid-name # pylint: disable=invalid-name
handler404 = 'contentstore.views.render_404' handler404 = 'contentstore.views.render_404'
......
...@@ -708,7 +708,12 @@ if settings.DEBUG: ...@@ -708,7 +708,12 @@ if settings.DEBUG:
# in debug mode, allow any template to be rendered (most useful for UX reference templates) # in debug mode, allow any template to be rendered (most useful for UX reference templates)
urlpatterns += url(r'^template/(?P<template>.+)$', 'debug.views.show_reference_template'), urlpatterns += url(r'^template/(?P<template>.+)$', 'debug.views.show_reference_template'),
#Custom error pages import debug_toolbar
urlpatterns += (
url(r'^__debug__/', include(debug_toolbar.urls)),
)
# Custom error pages
handler404 = 'static_template_view.views.render_404' handler404 = 'static_template_view.views.render_404'
handler500 = 'static_template_view.views.render_500' handler500 = 'static_template_view.views.render_500'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment