使用 python 部署 Google 应用引擎失败

Posted

技术标签:

【中文标题】使用 python 部署 Google 应用引擎失败【英文标题】:Deploying Google app engine with python failed 【发布时间】:2015-02-11 17:54:03 【问题描述】:

我尝试使用 Google App Engine 版本 1.19.7 和 Python 2.7.9 在 google CDN (appspot) 上部署一些文件。 我确信这不是一个大问题,但我不是专家。 我在“谷歌开发者”中创建了应用程序 文件 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 (使用一些好的编辑器?)进入至少可以正确复制和粘贴的状态到这里,然后再试一次...? 用户 'Japanish' 给了我答案。这是 Python 2.7.9 的问题。我使用了 Python 2.7.8,它运行良好。感谢您回答我的问题... 谷歌相关问题:code.google.com/p/googleappengine/issues/detail?id=11537 【参考方案1】:

如果您使用 Python 2.7.9,则应安装 Python 2.7.8。 当我在 Python 2.7.9 中运行 GAE/P 时,和你一样发生了这个错误。 但是,当我在 Python 2.7.8 中运行 GAE/P 时,它可以正常工作。 可能,2014-12-10 发布的 Python 2.7.9 和 2014-12-8 现在发布的 GAE/P 之间的区别。

请尝试 Python 2.7.8

【讨论】:

为我工作。谢谢!【参考方案2】:

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

【讨论】:

【参考方案3】:

如果要继续使用Python 2.7.9,解决方法如图: https://code.google.com/p/googleappengine/issues/detail?id=11536 为我工作。

只好改了三行代码,它就开始工作了。

【讨论】:

【参考方案4】:

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

【讨论】:

以上是关于使用 python 部署 Google 应用引擎失败的主要内容,如果未能解决你的问题,请参考以下文章

通过eclipse在Google应用引擎中部署时数据库未部署

在 Google App Engine 上部署 Django 项目

应用程序服务器的 gcm 服务器示例,部署在 java 中的 google app 引擎上

将基本的 Angular 2 应用程序部署到 Google App Engine

Quarkus 部署到 Google Cloud App 引擎失败

google-cloud 依赖项在 python 应用程序引擎中被覆盖