Using Django handler404 breaks Wagtail redirects

北城以北 提交于 2020-06-28 05:57:10

问题


I have a custom 404 handler that I use for my Django app running the CMS Wagtail. Everything works great with replacing the Django handler404 with a view function of my choosing. Except that it seems to break Wagtails 301 redirect feature. All of the redirects I have now just go to a 404 page. Below is how I am using handler404 in the base app,

handler404 = siteapp_views.handler404

回答1:


Your 404 handler must return a response with status_code=404, otherwise the Wagtail redirect middleware will not work.



来源:https://stackoverflow.com/questions/47060777/using-django-handler404-breaks-wagtail-redirects

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!