小编Han*_*ans的帖子

如何使用适用于Google Appengine Python的app.yaml创建自定义错误页面

对于使用Python编写的Google Appengine项目,我希望在发生错误时拥有自己的错误消息.我想使用error_handlers,如下所述:http: //code.google.com/intl/nl/appengine/docs/python/config/appconfig.html#Custom_Error_Responses

在应用程序中我使用webapp debug = False

当我在代码中创建错误时,我从浏览器中收到标准的500 Server错误消息.

我创建了一个名为的自定义错误页面 default_error.html

问题是:在哪里保存此自定义错误页面?

BTW这是我的app.yaml代码:

application: customerrorpage
version: 1
runtime: python
api_version: 1


error_handlers:
- file: default_error.html

handlers:
- url: /good.htm
  static_files: static/good.htm
  upload: static/good.htm

- url: /
  static_files: static/good.htm
  upload: static/good.htm

- url: /.*
  script: main.py
Run Code Online (Sandbox Code Playgroud)

python google-app-engine

6
推荐指数
1
解决办法
4059
查看次数

标签 统计

google-app-engine ×1

python ×1