@error(404)
def error404(error):
return 'Nothing here, sorry'
这是响应404的方式bottle framework
。但是在 404 上我想重定向到特定的 url 说http://abc.com/ http://abc.com/。是否可以?
@error(404)
def error404(error):
from bottle import redirect
# maybe test the error to see where you want to go next?
redirect(new_url, 303) # HTTP 303 should be used in this case
EDIT我不是 100% 确定这可以完成,而且我现在无法测试它,但我稍后会测试它并更新答案,除非你比我先一步。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)