【发布时间】:2014-06-10 07:28:15
【问题描述】:
我正在将 GAE 应用程序迁移到模块,但我的 api 模块的路由存在问题,基于 Google Endpoints。
基本上,我所有的 API 查询都被路由到默认模块,而其他路由运行良好
我的文件夹结构是
- /gae
-- dispatch.yaml
-- www/
---- www.yaml
---- [www module files]
-- foo/
---- foo.yaml
---- [foo module files]
-- api/api.yaml
---- api.yaml
---- [foo module files]
dispatch.yaml
application: testapp
dispatch:
- url: "testapp.appspot.com/"
module: default
- url: "*/_ah/spi/*"
module: api
- url: "*/_ah/api/*"
module: api
- url: "*/foo/*"
module: foomodule
我正在部署
cd gae
appcfg.py update www/www.yaml upload/upload.yaml api/api.yaml
appcfg.py update_dispatch .
我可以看到正在部署 3 个实例(每个模块一个)。
然后:
- http://testapp.appspot.com/xxx 等查询已正确路由到默认模块/实例
-
/foo/xxx ones由 foomodule 处理 - API 请求 (
/_ah/spi/xxx) 将使用 404 发送到默认模块。 - 奇怪的是,在启动应用程序时,我可以在
api实例的日志中看到/_ah/spi/BackendService.logMessages的 200 OK。
从日志中我还看到:
- 之前的logMessage 200 OK来自
alpha-dot-api-dot-testapp.appspot.com -
api模块的 404 来自testapp.appspot.com - 然而,非默认模块的 200 OK 也来自 ``testapp.appspot.com`
我做错了什么吗? Google Endpoints 在用作模块时需要任何特殊路由吗?
【问题讨论】:
标签: python google-app-engine module routing google-cloud-endpoints