app.yaml上的错误处理程序 [英] error-handlers on app.yaml

查看:102
本文介绍了app.yaml上的错误处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理应用引擎上的不同错误代码?在我的app.yaml文件中,我有 - $ / b>

How to handle different error codes on app engine? In my app.yaml file, I have-

error_handlers:
  - file: error/notfound.html

  - error_code: over_quota
    file: error/over_quota.html

handlers:
..some handlers..

这似乎不起作用。如果我的网站没有文件夹名称foo,并且用户查找 http://mysite.com/foo ,它只是返回一个标准的404错误,而不是我在app.yaml上指定的页面。

This doesn't seem to work. If my site doesn't have a folder name foo and a user looks for http://mysite.com/foo, it just returns a standard 404 error, not the page I specified on app.yaml.

我的静态目录与错误目录是分开的。错误和静态目录都在项目目录中。我缺少什么?

My static dir is separate from error dir. Both error and static dirs are inside project dir. What am I missing?

有没有办法显示自定义页面而不是自定义响应消息?

Is there a way to show custom page rather than a custom response message?

推荐答案

只有当URL无法匹配app.yaml中的任何模式时才会显示404错误处理程序页面。如果您的应用程序正在返回404,那么应用程序将显示您想要的错误页面 - 无法告诉框架显示默认错误页面。

The 404 error handler page will only be displayed if a URL fails to match any patterns in app.yaml. If your app is returning a 404, it's up to the app to display the error page you want - there's no way to tell the framework to display the default error page instead.

这篇关于app.yaml上的错误处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆