Django 404页面不显示 [英] Django 404 page not showing up
问题描述
我试图按照django文档的说明进行操作,并在我的模板文件夹中创建了一个404.html页面。我刚写道:这是一个404页面。在.html文件中。我也为500.html页面做了同样的事情,并在其中写道:这是一个500页。
但是当我打了一个坏页面时,我得到浏览器的标准404页面(Oops!此链接在Chrome中显示为破坏),当我希望这是一个404页面。
更有趣的是,在404.html中写下{%asdfjasdf%}的沮丧,而不是获得哎呀!...错误获得这是一个500页,所以它绝对看到了404.html模板。
这是我可以确认的:
- Debug = False
- 我在共享主机上运行apache
- 我没有做任何事情特殊的.htaccess和404错误。
- 如果我使用Debug = True,它说这是404错误。
- 我正在使用FastCGI
还有人认为我可以尝试吗?
非常感谢!
请参阅相关问题: Django 404页面未显示?
我不认为这与您的设置有关。 Chrome正在劫持404页面并显示糟糕消息。我希望如果您尝试在另一个浏览器中查看404页面,那么您将按预期的方式看到它。
I'm in the middle of putting up my first django application on shared hosting. This should be an easy thing, but I am just not seeing it.
I tried to follow the directions of the django documentation, and created a 404.html page within my template folder. I just wrote "This is a 404 page." in the .html file. I also did the same thing for a 500.html page and wrote in it "This is a 500 page."
However when I hit a 'bad page' I get a standard 404 page from the browser (Oops! This link appears to be broken. in Chrome) when I would expect "This is a 404 page."
What's even more interesting is out of frustration I wrote {% asdfjasdf %} in the 404.html, and instead of getting the "Oops!..." error I get "This is a 500 page," so it definitely sees the 404.html template.
Here's what I can confirm:
- Debug = False
- I am running apache on a shared hosting
- I have not done anything special with .htaccess and 404 errors.
- If I run with Debug = True, it says it's a 404 error.
- I am using FastCGI
Anything else anyone think I could try?
Thank you very much!
See this related question: Django 404 pages not appearing?
I don't think this has to do with your setup. Chrome is hijacking the 404 page and showing the 'Oops' message. I would expect that if you tried to view the 404 page in another browser you would see it as expected.
这篇关于Django 404页面不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!