【问题标题】:Why is my url in the following google appengine (python) yaml config file not recognized?为什么无法识别以下 google appengine (python) yaml 配置文件中的 url?
【发布时间】:2025-12-01 14:55:01
【问题描述】:

我在 python 中为我的 google appengine 应用程序提供了以下配置文件:

application: testapp-94974206
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /helloworld
  script: helloworld.application

- url: /
  script: helloworld.application

当调用不带前缀 (/) 的 url 时,我会调用我的“helloworld”应用程序,而当使用 /helloworld 调用时,我会得到一个 404 not found 错误页面。上面“/helloworld”的声明有什么问题?

【问题讨论】:

标签: python google-app-engine yaml


【解决方案1】:

我的问题实际上与另一个已经回答的问题很接近here

事实证明,/helloworld url 实际上被 appengine 很好地路由了,但罪魁祸首是 WSGI 路由器,它解析整个绝对 URL,而不仅仅是与 /helloworld 相关的那个,就像我想的那样。

【讨论】: