views:

121

answers:

2

I want to add a 404 page on my Django site.

I've created a template, 404.html, and saved it in the root of my /templates directory. I've also made sure that the

from django.conf.urls.defaults import *

line is included at the top of urls.py. I've set DEBUG to False. (I've been following these instructions.)

However, if I try to go to a page that I know doesn't exist - whether a made-up URL or a view specifically designed to do get_object_or_404 - the 404 page doesn't appear: I just get Chrome's standard 'Oops! This link appears to be broken' page.

Oddly, I also have a 500.html template in the same place and that is appearing just fine if I generate a 500 error. What might the problem be?

+1  A: 

I think that's a problem with Chrome not serving error pages properly - try unticking the "Show suggestions for navigation errors" box in the "Under the Hood" section of Chrome's options.

Dominic Rodger
That's exactly what it is, thanks. Should probably have tried that myself :)
AP257
@AP257 - no problem.
Dominic Rodger
+3  A: 

Start by checking this behavior in another browser. Chrome "hijacks" short 404 error pages and replaces them with it's own 'Oops! This link appears to be broken' page.

Ludwik Trammer
+1 for giving the same answer as me a tiny bit later!
Dominic Rodger
IE8 also hijacks the error page as well.
Matthew Doyle