简体   繁体   中英

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. Here's my original handlers part of my 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.

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: /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.

So you need 2 different routing patterns to route requests to 2 different scripts. 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. Something like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM