Skip to content

Commit 6921d34

Browse files
authored
Merge pull request #2292 from Divyessh/fix-custom-404-page-multi-page
fix custom 404 page error in multi page application
2 parents 3e16087 + 93c9de1 commit 6921d34

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2323

2424
### Fixed
2525

26+
- [#2292](https://github.com/plotly/dash/pull/2292) Pages: find the 404 page even if `pages_folder` is nested, or the 404 page is nested inside `pages_folder`.
2627
- [#2265](https://github.com/plotly/dash/pull/2265) Removed deprecated `before_first_request` as reported in [#2177](https://github.com/plotly/dash/issues/2177).
2728
- [#2257](https://github.com/plotly/dash/pull/2257) Fix tuple types in the TypeScript component generator.
2829

dash/dash.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,15 +2070,11 @@ def update(pathname, search):
20702070

20712071
# get layout
20722072
if page == {}:
2073-
module_404 = (
2074-
".".join([self.pages_folder, "not_found_404"])
2075-
if self.pages_folder
2076-
else "not_found_404"
2077-
)
2078-
not_found_404 = _pages.PAGE_REGISTRY.get(module_404)
2079-
if not_found_404:
2080-
layout = not_found_404["layout"]
2081-
title = not_found_404["title"]
2073+
for module, page in _pages.PAGE_REGISTRY.items():
2074+
if module.split(".")[-1] == "not_found_404":
2075+
layout = page["layout"]
2076+
title = page["title"]
2077+
break
20822078
else:
20832079
layout = html.H1("404 - Page not found")
20842080
title = self.title

0 commit comments

Comments
 (0)