【发布时间】:2023-03-27 02:38:01
【问题描述】:
是否可以重定向到 404 和 500 上的页面而不是构建自定义响应?我试过了-
class NotFoundPageHandler(webapp.RequestHandler):
def get(self):
#if 400
self.redirect('error/notfound.html')
#if 500 how to check
def main():
application = webapp.WSGIApplication(
[
('/', MainPage),
('/index.html', MainPage),
('.*', NotFoundPageHandler)
], debug=True)
但它不起作用。
【问题讨论】:
-
请,请不要这样做。出现错误时,提供适当的错误代码,不要将用户重定向到“错误”页面。它破坏了互联网。
标签: python google-app-engine http-status-code-404