[英]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: 像这样:
enwebXML.app
change /some_path
to /en/some_path
enwebXML.app
/some_path
enwebXML.app
更改为/en/some_path
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.