Add optional Debug Toolbar for optimization help.

This commit is contained in:
Josh W 2020-03-10 14:48:03 -04:00
parent 7b103c6c71
commit 704a792e49
3 changed files with 25 additions and 0 deletions

Binary file not shown.

View file

@ -152,6 +152,24 @@ AXES_META_PRECEDENCE_ORDER = [
AXES_PROXY_COUNT = 1 AXES_PROXY_COUNT = 1
#
# Django Debug Toolbar settings
#
DEBUG_TOOLBAR_ENABLED = config(
'DEBUG_TOOLBAR_ENABLED',
default=False,
cast=bool
)
INTERNAL_IPS = [
'127.0.0.1',
]
if DEBUG_TOOLBAR_ENABLED:
INSTALLED_APPS.append('debug_toolbar')
MIDDLEWARE.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware')
# #
# Django Rest Framework settings # Django Rest Framework settings
# #

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
@ -5,3 +6,9 @@ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('api/', include('api.urls')), path('api/', include('api.urls')),
] ]
if settings.DEBUG and settings.DEBUG_TOOLBAR_ENABLED:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns