From 33b3944c2a4c8b295ed2f6281efd282e0b68594c Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 17 May 2026 00:17:46 -0700 Subject: [PATCH] Gate debug urls on enabled debug apps --- archivebox/core/urls.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archivebox/core/urls.py b/archivebox/core/urls.py index 09f66bee..b249074c 100644 --- a/archivebox/core/urls.py +++ b/archivebox/core/urls.py @@ -3,6 +3,7 @@ __package__ = "archivebox.core" import sys from importlib.util import find_spec +from django.conf import settings from django.urls import path, re_path, include from django.views import static from django.views.generic.base import RedirectView @@ -83,10 +84,10 @@ def _raise_test_error(_request: HttpRequest): raise ZeroDivisionError("Intentional test error route") -if DEBUG and ("--nothreading" in sys.argv) and ("--reload" not in sys.argv) and find_spec("debug_toolbar"): +if getattr(settings, "DEBUG_TOOLBAR", False): urlpatterns += [path("__debug__/", include("debug_toolbar.urls"))] -if DEBUG and find_spec("requests_tracker"): +if getattr(settings, "DEBUG_REQUESTS_TRACKER", False) and find_spec("requests_tracker"): urlpatterns += [path("__requests_tracker__/", include("requests_tracker.urls"))]