【问题标题】:GAE Modules and Google EndpointsGAE 模块和 Google 端点
【发布时间】: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


    【解决方案1】:

    我看到 API 是默认模块,在 docs 中说“必须先上传默认模块”,您还需要将参数“模块:默认”放在 yaml 文件中或根本不包含 试试

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

    【讨论】:

      猜你喜欢
      • 2016-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多