mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[1.7.x] Fixed #24143 -- Encouraged use of Http404 messages for debugging.
Backport of 726a9550db from master
This commit is contained in:
@@ -121,13 +121,18 @@ Example usage::
|
||||
try:
|
||||
p = Poll.objects.get(pk=poll_id)
|
||||
except Poll.DoesNotExist:
|
||||
raise Http404
|
||||
raise Http404("Poll does not exist")
|
||||
return render_to_response('polls/detail.html', {'poll': p})
|
||||
|
||||
In order to use the ``Http404`` exception to its fullest, you should create a
|
||||
template that is displayed when a 404 error is raised. This template should be
|
||||
called ``404.html`` and located in the top level of your template tree.
|
||||
|
||||
If you provide a message when raising an ``Http404`` exception, it will appear
|
||||
in the standard 404 template displayed when :setting:`DEBUG` is ``True``. Use
|
||||
these messages for debugging purposes; they generally aren't suitable for use
|
||||
in a production 404 template.
|
||||
|
||||
.. _customizing-error-views:
|
||||
|
||||
Customizing error views
|
||||
|
||||
Reference in New Issue
Block a user