瀏覽代碼

tweak django debug toolbar panels and add djdt_flamegraph

Nick Sweeting 4 年之前
父節點
當前提交
c24e4bf11d
共有 2 個文件被更改,包括 20 次插入1 次删除
  1. 19 1
      archivebox/core/settings.py
  2. 1 0
      setup.py

+ 19 - 1
archivebox/core/settings.py

@@ -60,7 +60,25 @@ if DEBUG_TOOLBAR:
     INTERNAL_IPS = ['0.0.0.0', '127.0.0.1', '*']
     DEBUG_TOOLBAR_CONFIG = {
         "SHOW_TOOLBAR_CALLBACK": lambda request: True,
+        "RENDER_PANELS": True,
     }
+    DEBUG_TOOLBAR_PANELS = [
+        'debug_toolbar.panels.history.HistoryPanel',
+        'debug_toolbar.panels.versions.VersionsPanel',
+        'debug_toolbar.panels.timer.TimerPanel',
+        'debug_toolbar.panels.settings.SettingsPanel',
+        'debug_toolbar.panels.headers.HeadersPanel',
+        'debug_toolbar.panels.request.RequestPanel',
+        'debug_toolbar.panels.sql.SQLPanel',
+        'debug_toolbar.panels.staticfiles.StaticFilesPanel',
+        # 'debug_toolbar.panels.templates.TemplatesPanel',
+        'debug_toolbar.panels.cache.CachePanel',
+        'debug_toolbar.panels.signals.SignalsPanel',
+        'debug_toolbar.panels.logging.LoggingPanel',
+        'debug_toolbar.panels.redirects.RedirectsPanel',
+        'debug_toolbar.panels.profiling.ProfilingPanel',
+        'djdt_flamegraph.FlamegraphPanel',
+    ]
 
 
 MIDDLEWARE = [
@@ -72,7 +90,7 @@ MIDDLEWARE = [
     'django.contrib.messages.middleware.MessageMiddleware',
 ]
 if DEBUG_TOOLBAR:
-    MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware', *MIDDLEWARE]
+    MIDDLEWARE = [*MIDDLEWARE, 'debug_toolbar.middleware.DebugToolbarMiddleware']
 
 AUTHENTICATION_BACKENDS = [
     'django.contrib.auth.backends.ModelBackend',

+ 1 - 0
setup.py

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