The book "The definitive Guide to Django" says on page 476:

---8<---

... if you want to override the 404 view, you can specify 'handler404' in your 
URLconf, like so:


from django.conf.urls.defaults import *

urlpatterns = patterns ('',
...
)

handler404 = 'mysite.views.my_custom_404_view'



Behind the scenes ...

---8<---


hope this helps,

good luck,
TR



Am 18.01.2011 um 13:42 schrieb Ivo Brodien:

> I guess that django catches the 404 Error Code somehow somewhere else than in 
> the handler? Maybe you have to set the HTTP Code to 200?
> 
> 
> On 18.01.2011, at 13:35, galago wrote:
> 
>> Yes I have a index pattern:
>> urlpatterns = patterns('',
>>     url(r'^$', 'index.views.index', name='index'),.......
>> 
>> When I add print to my method:
>> def custom404(request):
>>     print 'foo'
>>     return HttpResponseRedirect(reverse('index'))
>> 
>> It prints out but it doesn't redirect me to index. Instead it displays my 
>> 404.html page.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to