Enable Django Debug Toolbar in development

master
David Fischer 2019-03-15 10:27:35 -07:00
parent 5747b1b61b
commit 608ccba64c
No known key found for this signature in database
GPG Key ID: F0C9B0ADA737AB60
3 changed files with 20 additions and 0 deletions

View File

@ -59,6 +59,18 @@ class CommunityDevSettings(CommunityBaseSettings):
logging['disable_existing_loggers'] = False
return logging
@property
def INSTALLED_APPS(self):
apps = super().INSTALLED_APPS
apps.append('debug_toolbar')
return apps
@property
def MIDDLEWARE(self):
middlewares = list(super().MIDDLEWARE)
middlewares.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware')
return middlewares
CommunityDevSettings.load_settings(__name__)

View File

@ -133,6 +133,11 @@ if not getattr(settings, 'USE_SUBDOMAIN', False) or settings.DEBUG:
if getattr(settings, 'ALLOW_ADMIN', True):
groups.append(admin_urls)
if getattr(settings, 'DEBUG', False):
import debug_toolbar
debug_urls += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
groups.append(debug_urls)
urlpatterns = reduce(add, groups)

View File

@ -95,3 +95,6 @@ django-cors-middleware==1.3.1
# User agent parsing - used for analytics purposes
user-agents<1.2.0
# Required only in development and linting
django-debug-toolbar==1.11