diff --git a/django/views/defaults.py b/django/views/defaults.py index 6c394490ab..8bf60c9d74 100644 --- a/django/views/defaults.py +++ b/django/views/defaults.py @@ -52,6 +52,8 @@ def page_not_found(request, exception, template_name=ERROR_404_TEMPLATE_NAME): if template_name != ERROR_404_TEMPLATE_NAME: # Reraise if it's a missing custom template. raise + # Render template (even though there are no substitutions) to allow + # inspecting the context in tests. template = Engine().from_string( '

Not Found

' '

The requested resource was not found on this server.

')