Is there any way to redirect all unmatched urls to a certain view in django? I can't use 404 page normally, as i have Debug = True
. Is there any way to do so?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It's kind of a hack, but it's simple enough - add a url that will match anything at the end of your other urls
url(r'^.*', 'myapp.my_custom_errorview'),
Remembre that yiou have to put it last, else it will override all other urls.