Skip to content

Commit

Permalink
Fixed #35703 -- Made technical_404_response() respect SCRIPT_NAME to …
Browse files Browse the repository at this point in the history
…return default_urlconf().
  • Loading branch information
maartenbreddels authored and sarahboyce committed Aug 23, 2024
1 parent f72bbd4 commit cdcd604
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/views/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def technical_404_response(request, exception):
else:
resolved = False
if not tried or ( # empty URLconf
request.path == "/"
request.path_info == "/"
and len(tried) == 1
and len(tried[0]) == 1 # default URLconf
and getattr(tried[0][0], "app_name", "")
Expand Down
9 changes: 9 additions & 0 deletions tests/view_tests/tests/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,15 @@ def test_default_urlconf_template(self):
response, "<h1>The install worked successfully! Congratulations!</h1>"
)

@override_settings(
ROOT_URLCONF="view_tests.default_urls", FORCE_SCRIPT_NAME="/FORCED_PREFIX"
)
def test_default_urlconf_script_name(self):
response = self.client.request(**{"path": "/FORCED_PREFIX/"})
self.assertContains(
response, "<h1>The install worked successfully! Congratulations!</h1>"
)

@override_settings(ROOT_URLCONF="view_tests.regression_21530_urls")
def test_regression_21530(self):
"""
Expand Down

0 comments on commit cdcd604

Please sign in to comment.