Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 901
Niklas Rosencrantz Avatar asked Oct 30 '11 15:10

Niklas Rosencrantz


2 Answers

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.

like image 144
systempuntoout Avatar answered Sep 28 '22 11:09

systempuntoout


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.

like image 39
Evan Plaice Avatar answered Sep 28 '22 11:09

Evan Plaice