GAE模块和Google端点 [英] GAE Modules and Google Endpoints

查看:119
本文介绍了GAE模块和Google端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将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.

但随后:


  • 查询,例如 http://testapp.appspot.com/xxx 已正确路由到默认模块/实例

  • / 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 the api 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 from testapp.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是默认模块,在 docs 中,还说必须先上传默认模块您需要在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 all Try

appcfg.py update  api/api.yaml www/www.yaml upload/upload.yaml #api first
appcfg.py update_dispatch

这篇关于GAE模块和Google端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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