Clarified 404.html usage, excplicitly stated that it's used when DEBUG is False

Thanks to Keryn Knight, Curtis Maloney and Tim Graham for their reviews.
This commit is contained in:
David Sanders 2015-08-28 17:55:17 +10:00 committed by Markus Holtermann
parent b79fc11d73
commit 7a98442f96
1 changed files with 8 additions and 7 deletions

View File

@ -122,14 +122,15 @@ Example usage::
raise Http404("Poll does not exist") raise Http404("Poll does not exist")
return render_to_response('polls/detail.html', {'poll': p}) return render_to_response('polls/detail.html', {'poll': p})
In order to use the ``Http404`` exception to its fullest, you should create a In order to show customized HTML when Django returns a 404, you can create an
template that is displayed when a 404 error is raised. This template should be HTML template named ``404.html`` and place it in the top level of your
called ``404.html`` and located in the top level of your template tree. template tree. This template will then be served when :setting:`DEBUG` is set
to ``False``.
If you provide a message when raising an ``Http404`` exception, it will appear When :setting:`DEBUG` is ``True``, you can provide a message to ``Http404`` and
in the standard 404 template displayed when :setting:`DEBUG` is ``True``. Use it will appear in the standard 404 debug template. Use these messages for
these messages for debugging purposes; they generally aren't suitable for use debugging purposes; they generally aren't suitable for use in a production 404
in a production 404 template. template.
.. _customizing-error-views: .. _customizing-error-views: