简体   繁体   English

app.yaml文件:运行2个Python文件Google App Engine

[英]app.yaml file: Running 2 Python Files Google App Engine

I have a Google App working and I would like to make it run 2 python files instead of one. 我有一个正在运行的Google App,我想使其运行2个python文件而不是一个。 Here's my original handlers part of my app.yaml 这是我app.yaml的原始处理程序部分

handlers:
- url: /.*
  script: enwebXML.app

Then I wanted to make it run 2 different python files but it just does whatever the first one is doing so it just ignores the seconde file. 然后我想让它运行2个不同的python文件,但是它只执行第一个文件所做的任何事情,因此它只忽略了seconde文件。

handlers:
- url: /.*
  script: enwebXML.app
- url: /.*
  script: frwebXML.app

I just think that since it's the same url it doesn't go through the second one, I tried to change the urls to 2 sub urls but no chance it doesn't work for some reason, here's the urls I tried with: 我只是认为,因为它是相同的URL,所以它不会通过第二个URL,所以我尝试将URL更改为2个子URL,但是由于某种原因,它没有任何机会不起作用,这是我尝试过的URL:

-url: /en/.*
-url: /fr/.*

Since it doesn't work I would like to know if there's something I can do like: 由于它不起作用,所以我想知道是否可以做一些事情:

handlers:
- url: /.*
  script: enwebXML.app
  script: frwebXML.app

The app.yaml pattern url routing works on a 1st match basis: whichever pattern matches first wins and the respective script is invoked - as you observed. app.yaml模式url路由在第一个匹配基础上工作:正如您所观察到的那样,无论哪个模式匹配第一个获胜者,都会调用相应的脚本。

So you need 2 different routing patterns to route requests to 2 different scripts. 因此,您需要2 种不同的路由模式将请求路由到2个不同的脚本。 You were on the right track: 您走在正确的轨道上:

handlers:
- url: /en/.*
  script: enwebXML.app
- url: /fr/.*
  script: frwebXML.app

Of course, you'll need to update accordingly the app handler mapping patterns in each of the scripts. 当然,您需要相应地更新每个脚本中的app处理程序映射模式。 Something like this: 像这样:

  • in enwebXML.app change /some_path to /en/some_path enwebXML.app /some_path enwebXML.app更改为/en/some_path
  • in frwebXML.app change /some_path to /fr/some_path frwebXML.app /some_path frwebXML.app更改为/fr/some_path

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine | Python |的app.yaml - Google App Engine | Python | APP.YAML 如何为Google App Engine应用程序写入`app.yaml`文件? - How to write `app.yaml` file for Google App Engine app? Google应用程序引擎python cron:app.yaml文件中的testcron.py在做什么? - Google app engine python cron: What is the testcron.py doing in the app.yaml file? app.yaml /项目文件结构适用于app引擎localhost调试器,但不适用于谷歌应用引擎服务器 - app.yaml / project file structure works on app engine localhost debugger but not on google app engine server 如何使用应用工厂将 Flask 应用部署到 Google Cloud(App Engine),以及如何编写 app.yaml 文件? - How to deploy a Flask app to Google Cloud (App Engine) with an application factory, and how to write the app.yaml file? Google App Engine 不为我在 app.yaml 中定义的入口点提供服务 - Google App Engine is not servig my defined entrypoint in app.yaml Google App Engine中的身份验证:app.yaml与python代码 - Authentication in Google App Engine: app.yaml vs. python code 如何使用Google App Engine Python将变量从app.yaml传递到main.py. - How to pass a variable from app.yaml to main.py with Google App Engine Python 如何在登录名中使用自定义身份验证:app.yaml中的required属性(Google App引擎,python) - How to use custom authentication with the login: required attribute in app.yaml ( Google app engine, python ) Python App Engine:使用app.yaml来控制url处理程序 - Python App Engine : use app.yaml to control url handler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM