From 37d7e8d99fa3cee1fa33c868ecc5bf7dbcef6394 Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Tue, 3 Jan 2023 14:06:51 +0100 Subject: [PATCH] fix debug toolbar --- app/settings.py | 7 ++++--- app/urls.py | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/settings.py b/app/settings.py index 97f8ef63..95526b1b 100644 --- a/app/settings.py +++ b/app/settings.py @@ -13,6 +13,7 @@ sys.dont_write_bytecode = True DEBUG_ENV = os.environ.get('DEBUG') == 'True' DEBUG = DEBUG_ENV +DEBUG_TOOLBAR = False TEMPLATE_DEBUG = DEBUG RECOVERY = False @@ -163,7 +164,7 @@ TEMPLATE_LOADERS = ( )), ) -MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG else ()) + ( +MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOLBAR else ()) + ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -204,7 +205,7 @@ INSTALLED_APPS = ( ) -if DEBUG: +if DEBUG_TOOLBAR: INSTALLED_APPS += ('debug_toolbar',) TEMPLATES = [ @@ -509,7 +510,7 @@ SHERLOKS_USE_TRANSACTION_ID = True ORAL_OPTION_PRICE = 250 -if DEBUG: +if DEBUG_TOOLBAR: def show_toolbar(request): return True DEBUG_TOOLBAR_CONFIG = { diff --git a/app/urls.py b/app/urls.py index e601f98d..7f365327 100644 --- a/app/urls.py +++ b/app/urls.py @@ -2,6 +2,7 @@ import os from django.conf.urls import include, url +from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin from django.http import HttpResponse @@ -11,9 +12,7 @@ admin.autodiscover() js_info_dict = ['teleforma'] -DEBUG_ENV = os.environ.get('DEBUG') == 'True' - -if DEBUG_ENV: +if settings.DEBUG_TOOLBAR: import debug_toolbar urlpatterns = [ @@ -38,5 +37,5 @@ urlpatterns = [ #url(r'^pdfviewer/', include('webviewer.urls')), url(r'^pdfannotator/', include('pdfannotator.urls')), url(r'^messages/', include('postman.urls', namespace='postman')), -] + ([url(r'^__debug__/', include(debug_toolbar.urls)),] if DEBUG_ENV else []) +] + ([url(r'^__debug__/', include(debug_toolbar.urls)),] if settings.DEBUG_TOOLBAR else []) -- 2.39.5