google-app-engine - 使用 dispatch.yaml 进行 Google App Engine 路由

标签 google-app-engine url-routing google-app-engine-python

我尝试在我的沙箱 GCP 项目上部署一个 Web 应用程序,其中已经部署了一个应用程序。因此,我正在尝试使用同时部署两个 Web 应用程序的路径。

我的 express 看起来像这样

dispatch:

- url: "*/wc/api/.*"
  service: wc-api

- url: "*/wc/.*"
  service: wc-front


- url: "*/.*"
  service: default

当我这样做时,我对 mysandbox.appspot.com/wc/的所有调用都会被重定向到我的 default服务,我不明白为什么(我可以在 default 服务的日志中看到调用)。

如果这有帮助,这里是 app.yaml我的 wc-front服务。
runtime: python27
api_version: 1
threadsafe: yes
service: wc-front

default_expiration: "10m"

handlers:
- url: /wc/.*
  script: app.APP
  login: required
  secure: always

你看到这有什么错误吗?

(直接调用 wc-front-dot-mysandbox.appspot.com/wc/会返回典型的 App Engine 404 错误)

谢谢

最佳答案

是的,确实,您需要配置您的 dispatch.yaml文件,以便 App Engine 根据您在其中设置的 URL 路由您的应用程序。看来你的 service: default它获取所有 URL 并将它们重定向到那里的服务集。

考虑到这一点,我建议您查看有关配置dispatch.yaml 的官方文档。文件 - 您可以获得有关如何配置它的一些更好的想法 - 以及来自社区的另一篇文章,其中另一个用户具有与您类似的用例,我认为应该对您有所帮助。

  • dispatch.yaml Configuration File
  • How to use GAE's dispatch.yaml with multiple development environments?

  • 如果这些信息对您有帮助,请告诉我!

    关于google-app-engine - 使用 dispatch.yaml 进行 Google App Engine 路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60493559/

    相关文章:

    google-app-engine - 尝试登录本地 Google AppEngine 服务器时出现 503 错误

    javascript - Angular JS 中的多斜线路由 (1.2.x)

    python - Python Google App Engine 的文件上传示例?

    google-app-engine - 在 Google appengine 中禁用版本特定的 url

    c# - 在 ASP.NET Core(以前的 ASP.NET 5)中嵌套路由的便捷方式是什么?

    python-3.x - 无法在 google-app-engine 中使用 collections.defaultdict()

    javascript - 使用 pyfacebook 显示 xfbml 时出现问题

    google-app-engine - Google App Engine 与 Spring Roo

    go - 使用Go显示代码而不是请求GCP响应的代码

    用于参数化路由的 Next.js 子页面