[Django] #10934: handler404 needs an example

53 views
Skip to first unread message

Django

unread,
Apr 27, 2009, 8:04:46 AM4/27/09
to djang...@holovaty.com, django-...@googlegroups.com
#10934: handler404 needs an example
---------------------------+------------------------------------------------
Reporter: mnieber | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.0
Keywords: handler404 | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
Hi,

I'm doing the tutorial and tried to set up my own 404 handler, following
the hints in the tutorial.
However, here the tutorial is not clear:

- where exactly does Django look for the handler404 name?
- should I assign a new object to django.conf.urls.defaults.handler404, or
create the name handler404 inside the views module?
- I did not create a 404.html, how come Django does not complain about
that? (quote: The default 404 view will use that template for all 404
errors.)

An example of setting up your own 404 handler would help a lot (I still
have not managed, so now it feels like I missed a point somewhere).
By the way, the tutorial is excellent in all other aspects!

--
Ticket URL: <http://code.djangoproject.com/ticket/10934>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 6, 2009, 11:33:36 PM5/6/09
to djang...@holovaty.com, django-...@googlegroups.com
#10934: handler404 needs an example
------------------------------------+---------------------------------------
Reporter: mnieber | Owner: nobody
Status: new | Milestone:
Component: Documentation | Version: 1.0
Resolution: | Keywords: handler404
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by thejaswi_puthraya):

* needs_better_patch: => 0
* component: Uncategorized => Documentation
* needs_tests: => 0
* needs_docs: => 0

--
Ticket URL: <http://code.djangoproject.com/ticket/10934#comment:1>

Django

unread,
May 25, 2009, 11:44:49 PM5/25/09
to djang...@holovaty.com, django-...@googlegroups.com
#10934: handler404 needs an example
------------------------------------+---------------------------------------
Reporter: mnieber | Owner: nobody
Status: new | Milestone:
Component: Documentation | Version: 1.0
Resolution: | Keywords: handler404
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by SmileyChris):

* stage: Unreviewed => Accepted

--
Ticket URL: <http://code.djangoproject.com/ticket/10934#comment:2>

Django

unread,
Mar 13, 2010, 3:54:21 AM3/13/10
to djang...@holovaty.com, django-...@googlegroups.com
#10934: handler404 needs an example
------------------------------------+---------------------------------------
Reporter: mnieber | Owner: nobody
Status: closed | Milestone:
Component: Documentation | Version: 1.0
Resolution: worksforme | Keywords: handler404
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by rctay):

* status: new => closed
* resolution: => worksforme

Comment:

Replying to [ticket:10934 mnieber]:
> - where exactly does Django look for the handler404 name?

According to the third paragraph of
[[http://docs.djangoproject.com/en/dev/topics/http/views/#the-404-page-
not-found-view the 404 doc]], Django looks in your `urls.py`.

> - should I assign a new object to django.conf.urls.defaults.handler404,
or create the name handler404 inside the views module?

This is also addressed in that same paragraph. You just define a variable
`handler404` and you're set.

> - I did not create a 404.html, how come Django does not complain about
that? (quote: The default 404 view will use that template for all 404
errors.)

AFAIK, django doesn't provide a default `404.html`. If you didn't create
one, you should get a 'template not found' error - that is, if you trigger
a 404, AND disable `DEBUG` or `TEMPLATE_DEBUG` in your settings (not sure
which).

If this isn't the case, then this is a bug with django's template loading
system which should be addressed in a separate ticket.

--
Ticket URL: <http://code.djangoproject.com/ticket/10934#comment:3>
Reply all
Reply to author
Forward
0 new messages