Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't check for URLs if ROOT_URLCONF isn't defined
  • Loading branch information
scott-8 committed Apr 10, 2026
commit e9381e337fd5c7b2733c95fe6c00094e0bbdecb3
15 changes: 10 additions & 5 deletions debug_toolbar/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,17 @@ def debug_toolbar_installed_when_running_tests_check(app_configs, **kwargs):
dt_settings.get_config()["SHOW_TOOLBAR_CALLBACK"]
!= CONFIG_DEFAULTS["SHOW_TOOLBAR_CALLBACK"]
)
try:
# Check if the toolbar's urls are installed
reverse(f"{APP_NAME}:render_panel")
toolbar_urls_installed = True
except NoReverseMatch:

if not hasattr(settings, "ROOT_URLCONF"):
# reverse will raise AttributeError if ROOT_URLCONF is not defined
toolbar_urls_installed = False
else:
try:
# Check if the toolbar's urls are installed
reverse(f"{APP_NAME}:render_panel")
toolbar_urls_installed = True
except NoReverseMatch:
toolbar_urls_installed = False

# If the user is using the default SHOW_TOOLBAR_CALLBACK,
# then the middleware will respect the change to settings.DEBUG.
Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change log

Pending
-------
* Prevent check from failing when ``ROOT_URLCONF`` is not defined.

6.3.0 (2026-04-01)
------------------
Expand Down
Loading