1
0
Fork 0

add debug toolbar

This commit is contained in:
Nick Sweeting 2021-02-16 02:50:05 -05:00
parent fad2620c62
commit 26fa63749d
3 changed files with 47 additions and 30 deletions

View File

@ -40,7 +40,8 @@ LOGOUT_REDIRECT_URL = '/'
PASSWORD_RESET_URL = '/accounts/password_reset/' PASSWORD_RESET_URL = '/accounts/password_reset/'
APPEND_SLASH = True APPEND_SLASH = True
DEBUG = DEBUG or ('--debug' in sys.argv) DEBUG = True # DEBUG or ('--debug' in sys.argv)
DEBUG_TOOLBAR = True
INSTALLED_APPS = [ INSTALLED_APPS = [
'django.contrib.auth', 'django.contrib.auth',
@ -54,6 +55,12 @@ INSTALLED_APPS = [
'django_extensions', 'django_extensions',
] ]
if DEBUG_TOOLBAR:
INSTALLED_APPS = [*INSTALLED_APPS, 'debug_toolbar']
INTERNAL_IPS = ['0.0.0.0', '127.0.0.1', '*']
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda request: True,
}
MIDDLEWARE = [ MIDDLEWARE = [
@ -64,6 +71,8 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
] ]
if DEBUG_TOOLBAR:
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware', *MIDDLEWARE]
AUTHENTICATION_BACKENDS = [ AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.ModelBackend',
@ -226,12 +235,12 @@ LOGGING = {
'loggers': { 'loggers': {
'django': { 'django': {
'handlers': ['console', 'logfile'], 'handlers': ['console', 'logfile'],
'level': 'DEBUG', 'level': 'INFO',
'filters': ['noisyrequestsfilter'], 'filters': ['noisyrequestsfilter'],
}, },
'django.server': { 'django.server': {
'handlers': ['console', 'logfile'], 'handlers': ['console', 'logfile'],
'level': 'DEBUG', 'level': 'INFO',
'filters': ['noisyrequestsfilter'], 'filters': ['noisyrequestsfilter'],
} }
}, },

View File

@ -36,7 +36,14 @@ urlpatterns = [
path('', HomepageView.as_view(), name='Home'), path('', HomepageView.as_view(), name='Home'),
] ]
# # Proposed UI URLs spec if settings.DEBUG_TOOLBAR:
import debug_toolbar
urlpatterns += [
path('__debug__/', include(debug_toolbar.urls)),
]
# # Proposed FUTURE URLs spec
# path('', HomepageView) # path('', HomepageView)
# path('/add', AddView) # path('/add', AddView)
# path('/public', PublicIndexView) # path('/public', PublicIndexView)

View File

@ -65,6 +65,7 @@ EXTRAS_REQUIRE = {
"pytest", "pytest",
"bottle", "bottle",
"stdeb", "stdeb",
"django-debug-toolbar",
], ],
} }