Add user-friendly explanation to 404 error template

This commit is contained in:
Ross
2026-02-02 17:04:33 +00:00
parent 3c0deec140
commit f6b990a00a
+4 -1
View File
@@ -686,7 +686,10 @@ def stats(request):
# HTTP Error 400
def page_not_found(request, exception):
response = render(request, "404.html")
# Provide the exception message (reason) to the template so callers
# can show a user-friendly explanation when available.
context = {"reason": str(exception) if exception is not None else "Not found"}
response = render(request, "404.html", context=context)
response.status_code = 404