如何将我的app.yaml迁移到2.7?

时间:2011-10-30 15:39:02

标签: python google-app-engine python-2.7 yaml

我正在将我的gae应用程序迁移到python 2.7。这是我的新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

但我收到此错误消息:

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

您能告诉我如何解决错误吗?

2 个答案:

答案 0 :(得分:7)

检查source code,看起来您需要定义处理程序的路径而不带任何斜杠:

   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)

application.py移动到项目的根目录并相应地修改处理程序的路径。

答案 1 :(得分:7)

更改

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

收件人:

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

您可能还需要在'mapreduce'文件夹中添加 __ init __。py ,如果已存在的话。这将使python将文件夹解释为模块。