问题描述
我正在将GAE应用程序迁移到模块,并且根据Google端点,我的 api
模块的路由遇到问题。
I'm migrating a GAE application to modules, and have issues with the routing for my api
module, based on Google Endpoints.
基本上,我所有的API查询都路由到默认模块,而其他路由运行良好
Basically, all my API queries are routed to the default module, while other routing works well
我的文件夹结构是
- /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
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个实例(每个模块一个)。
I can see 3 instances (one per module) being deployed.
但随后:
- 查询,例如已正确路由到默认模块/实例
-
/ foo / xxx的
由foomodule - API请求处理(
/ _ ah / spi / xxx
)会使用404进入默认模块。 - 奇怪的是,启动应用程序时,我看到
/ _ ah / spi / BackendService.logMessages
放在api
实例的日志中。
- queries such as http://testapp.appspot.com/xxx are correctly routed to the default module/instance
/foo/xxx ones
are handled by the foomodule- API requests (
/_ah/spi/xxx
) are going to the default module with a 404. - Strangely, when starting the app, I can see a 200 OK for
/_ah/spi/BackendService.logMessages
in the logs of theapi
instance.
从日志中,我还看到:
- 以前的logMessage 200 OK来自
alpha-dot-api-dot -testapp.appspot.com
-
api
模块的404来自testapp.appspot.com
- 但是,非默认模块的200 OK也来自``testapp.a ppspot.com`
- The previous logMessage 200 OK comes from
alpha-dot-api-dot-testapp.appspot.com
- The 404 for the
api
module are fromtestapp.appspot.com
- Yet, the 200 OK for non-default modules are also from ``testapp.appspot.com`
我在做错什么吗? Google端点用作模块时需要任何特殊的路由吗?
Is there anything that I'm doing wrong? Any special routing needed for Google Endpoints when they're used as modules?
推荐答案
如我所见,API是默认模块,在中,还说必须先上传默认模块您需要在yaml文件中放置参数 module:default,或者根本不包含参数
试试
As i see the API is the default module, in the docs say "the default module must be uploaded first" also you need put the parameter "module: default" in the yaml file or not included at allTry
appcfg.py update api/api.yaml www/www.yaml upload/upload.yaml #api first
appcfg.py update_dispatch
这篇关于GAE模块和Google端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!