【发布时间】:2019-02-05 08:29:14
【问题描述】:
我为我的 Django 项目定义了错误 400 和 404 的自定义模板。当我尝试访问网站的生产版本时,错误 404 模板已正确加载缺失页面。但是,如果我向我的 Apache/Django 服务器发送错误请求(例如http://mysite.example.com/%),则不会加载错误 400 的模板,而是会呈现常规的 Apache 错误页面:
Bad Request
Your browser sent a request that this server could not understand.
Apache/2.4.18 (Ubuntu) Server at mysite.example.com Port 80
Apache 是否将这个请求转发给 Django,还是我需要在我的 Django 项目中定义 handler400 才能使其工作(尽管我不必为 404.html 这样做)?
【问题讨论】:
标签: python django python-3.x apache