代码之家  ›  专栏  ›  技术社区  ›  ffejrekaburb

使用Google app Engine时,指定404和500的最佳方式是什么

  •  0
  • ffejrekaburb  · 技术社区  · 7 年前

    我的app.yaml当前为错误指定了以下内容。

    错误处理程序:

    • 文件:templates/error_static.html

    在flask框架内,可以根据以下内容指定错误处理程序

    @app.errorhandler(400)  # Bad Request
    @app.errorhandler(401)  # Unauthorized
    @app.errorhandler(403)  # Forbidden
    @app.errorhandler(404)  # Not Found
    @app.errorhandler(405)  # Method Not Allowed
    @app.errorhandler(410)  # Gone
    @app.errorhandler(418)  # I'm a Teapot
    @app.errorhandler(422)  # Unprocessable Entity
    @app.errorhandler(500)  # Internal Server Error
    def error_handler(e):
    

    当在app.yaml内指定404时,这是否会取代上述内容?

    错误处理程序: -文件:templates/error_static.html

    如果app.yaml指定了通配符路由和404处理程序,是否有理由保留上述内容?

    0 回复  |  直到 7 年前
    推荐文章