From c257ae240e6f1a5c1bbf2fd48067bf0786639ce4 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 18 Feb 2021 08:04:26 -0500 Subject: [PATCH] only enable debug toolbar if nothreading is on --- archivebox/core/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index acae442b..0a33d7f1 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -65,13 +65,14 @@ AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', ] -DEBUG_TOOLBAR = False -if DEBUG: +# only enable debug toolbar when in DEBUG mode with --nothreading (it doesnt work in multithreaded mode) +DEBUG_TOOLBAR = DEBUG and ('--nothreading' in sys.argv) and ('--reload' not in sys.argv) +if DEBUG_TOOLBAR: try: import debug_toolbar # noqa DEBUG_TOOLBAR = True except ImportError: - pass + DEBUG_TOOLBAR = False if DEBUG_TOOLBAR: INSTALLED_APPS = [*INSTALLED_APPS, 'debug_toolbar']