使用Python部署Google应用引擎失败。

17

我尝试使用Google App Engine 1.19.7和Python 2.7.9将一些文件部署到Google CDN(appspot)上。 我确信这不是什么大问题,但我不是专家。 我已在“Google开发者”中创建了应用程序。 文件app.yaml的内容为:

application: o-naturel  version: 1 runtime: python27 api_version: 1 threadsafe: true

# Expiration des fichiers : 30 jours default_expiration: "30d"

handlers:
- url: /styles   static_dir: styles

- url: /images   static_dir: images

- url: /files   static_dir: files

#- url: /.*
#  static_files: index.html
#  upload: index.html

以下是部署过程中出现的错误,请帮我解决。因为我无法跟进我的网站开发情况,所以希望能得到答案。非常感谢!!!

2014-12-12 17:56:28 Running command: "['C:\\Python27\\pythonw.exe', '-u', 'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=patrick.sanchez24@gmail.com', '--passin', 'update', 'D:\\Cdn-App_o-naturel']"
05:56 PM Application: o-naturel; version: 1
05:56 PM Host: appengine.google.com
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 127, in <module>
    run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 123, in run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5397, in <module>
    main(sys.argv)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5388, in main
    result = AppCfgApp(argv).Run()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2978, in Run
    self.action(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5044, in __call__
    return method()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3791, in Update
    self._UpdateWithParsedAppYaml(appyaml, self.basepath)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3812, in _UpdateWithParsedAppYaml
    updatecheck.CheckForUpdates()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\sdk_update_checker.py", line 243, in CheckForUpdates
    runtime=runtime))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc.py", line 424, in Send
    f = self.opener.open(req)
  File "C:\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1240, in https_open
    context=self._context)
TypeError: do_open() got an unexpected keyword argument 'context'
2014-12-12 17:56:31 (Process exited with code 1)

You can close this window now.

似乎在您发布的 app.yaml 文件中缺少许多换行符 -- 可能是 Windows 换行符的问题吗?不确定会引起什么问题(我不使用 Windows :-)),但您能否尝试使用某个好的编辑器将 app.yaml 文件调整到至少可以正确复制和粘贴到这里的状态,并再次尝试...? - Alex Martelli
用户'Japanish'给了我答案。这是Python 2.7.9的问题。我使用Python 2.7.8,它完美地解决了问题。感谢您回答我的问题... - Patrick Sanchez
相关的谷歌问题:https://code.google.com/p/googleappengine/issues/detail?id=11537 - Brian M. Hunt
4个回答

15
如果您使用的是Python 2.7.9,则应安装Python 2.7.8。 当我在Python 2.7.9中运行GAE/P时,就像您一样出现了此错误。 但是,当我在Python 2.7.8中运行GAE/P时,它正常工作。 可能的区别在于Python 2.7.9发布于2014年12月10日,而GAE/P现在发布于2014年12月8日之间。 请尝试使用Python 2.7.8。

对我有用。谢谢! - Lee

5

SDK似乎存在一个错误。 请查看上面Deep的链接。 对我来说,最简单的解决方案是添加: --skip_sdk_update_check=yes 到其他选项中。 稍后我将手动检查并下载更新版本,然后再次删除该选项。


4

2

我通过升级Google App Engine SDK到1.9.18版本来解决了这个问题(在GoogleAppEngineLauncher UI中使用“帮助”>“检查更新”)。 我正在运行Python 2.7.9。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接