Pārlūkot izejas kodu

only enable debug toolbar if nothreading is on

Nick Sweeting 4 gadi atpakaļ
vecāks
revīzija
c257ae240e
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. 4 3
      archivebox/core/settings.py

+ 4 - 3
archivebox/core/settings.py

@@ -65,13 +65,14 @@ AUTHENTICATION_BACKENDS = [
     'django.contrib.auth.backends.ModelBackend',
     '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:
     try:
         import debug_toolbar   # noqa
         import debug_toolbar   # noqa
         DEBUG_TOOLBAR = True
         DEBUG_TOOLBAR = True
     except ImportError:
     except ImportError:
-        pass
+        DEBUG_TOOLBAR = False
 
 
 if DEBUG_TOOLBAR:
 if DEBUG_TOOLBAR:
     INSTALLED_APPS = [*INSTALLED_APPS, 'debug_toolbar']
     INSTALLED_APPS = [*INSTALLED_APPS, 'debug_toolbar']