Django 404 pages not showing?

I want to add page 404 on my Django site.

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

 from django.conf.urls.defaults import * 
Line

listed at the top of urls.py. I set DEBUG to False. (I followed these instructions .)

However, if I try to go to a page that, as I know, does not exist - whether it is a created URL or a view specifically designed to execute get_object_or_404 - page 404 does not appear: I just get Chrome standard 'Oh! This link looks broken.

Oddly enough, I also have a 500.html template in the same place, and it looks just fine if I generate a 500 error. What is the problem?

+4
source share
2 answers

I think that the problem with Chrome does not serve error pages correctly - try unchecking "Show suggestions for navigation errors" in the "Under the Hood" section in Chrome settings.

+4
source

Start by testing this behavior in a different browser. Chrome โ€œcapturesโ€ the short 404 error pages and replaces them with its own โ€œOh! This link looks broken.

+3
source

Source: https://habr.com/ru/post/1306119/


All Articles