我自己举起404时的web2py自定义404页面? [英] web2py custom 404 page when I raise the 404 myself?
问题描述
我的控制器中有一个接受HTTP GET请求的函数.在该请求的某些参数值上,我想提出一个404.我也希望将404重新路由到我可以制作的另一个html页面,而不是提供该通用
I have a function in my controller that take an HTTP GET request. On certain argument values of that request I want to raise a 404. I also want that 404 to get rerouted to a different html page that I can make instead of giving that generic
404未找到
或任何带有消息的内容.我在我的应用程序的根目录中创建了一个routes.py,其中包含
or whatever with a message. I made a routes.py which is in the root directory of my application and it contains
routes_onerror[('myapp/404', 'myapp/static/404.html')]
我的静态文件夹中也有404.HTML.我正在尝试做路线的预定用途吗?
And I also have a 404.HTML in my static folder. Is what I am trying to do the intended use of routes?
推荐答案
缺少=
,并且URL前面应带有/
:
Missing an =
, and the URL should be preceded by a /
:
routes_onerror = [('myapp/404', '/myapp/static/404.html')]
这篇关于我自己举起404时的web2py自定义404页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!