简体   繁体   中英

How to migrate my app.yaml to 2.7?

I'm migrating my gae app to python 2.7. This is my new app.yaml:

application: webfaze
version: main
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /mapreduce(/.*)?
  script: mapreduce/main.application

- url: /(.*\.(html|css|js|gif|jpg|png|ico|swf))
  static_files: static/\1
  upload: static/.*
  expiration: "1d"

- url: .*
  script: main.application

- url: /task/.*
  script: main.application
  login: admin

But I get this error message:

Error parsing yaml file:
Invalid object:
threadsafe cannot be enabled with CGI handler: mapreduce/main.application
  in "webfaze/app.yaml", line 22, column 1

Can you tell me how to resolve the error?

Checking the source code , it looks that you need to define your handlers' path without any slash:

   if (handler.script and (handler.script.endswith('.py') or 
       '/' in handler.script)):
       raise appinfo_errors.ThreadsafeWithCgiHandler(
                    'threadsafe cannot be enabled with CGI handler: %s' %
                    handler.script)

Move application.py to the root of your project and modify the handler's path accordingly.

Change:

- url: /mapreduce(/.*)?
  script: mapreduce/main.application

To:

- url: /mapreduce(/.*)?
  script: mapreduce.main.application

You may also need to add an __init__.py to the 'mapreduce' folder if one doesn't exist there already. That will make the python interpret the folder as a module.

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