【发布时间】:2013-04-18 01:24:39
【问题描述】:
背景
“在 Python 运行时,我们添加了对 Python SSL 的支持 库,因此您现在可以打开与远程服务的安全连接 例如 Apple 的推送通知服务。”
此报价为taken from a recent post on the Google App Engine blog。
实施
如果您想使用本机 python ssl,您必须使用应用程序 app.yaml 文件中的库配置启用它,在该文件中您指定库名称“ssl”。 . .
这些说明通过Google App Engine documentation 提供给开发人员。
以下行已添加到app.yaml 文件中:
libraries:
- name: ssl
version: latest
这与通过 Google App Engine 文档提供的建议一致。
问题
我尝试过以三种不同的配置运行我的项目。两个在工作,一个没有。
工作...
在我将应用程序上传到 Google App Engine 并通过实时服务器运行我的项目后,一切正常。
工作...
当我使用manage.py runserver 运行我的项目并将Google App Engine SKD 包含在我的PYTHONPATH 中时,一切正常。
不工作...
但是,当我使用 dev_appserver.py 运行我的项目时,我收到以下错误:
ImportError at /
No module named _ssl
Request Method: GET
Request URL: http://localhost:8080/
Django Version: 1.4.3
Exception Type: ImportError
Exception Value:
No module named _ssl
Exception Location: /usr/local/lib/google_appengine_1.7.7/google/appengine/tools/devappserver2/python/sandbox.py in load_module, line 856
Python Executable: /home/rbose85/Code/venvs/appserver/bin/python
Python Version: 2.7.3
Python Path:
['/home/rbose85/Code/product/site',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/home/rbose85/Code/venvs/appserver/lib/python2.7',
'/home/rbose85/Code/venvs/appserver/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/local/lib/google_appengine',
u'/usr/local/lib/google_appengine_1.7.7/lib/django-1.4',
u'/usr/local/lib/google_appengine_1.7.7/lib/ssl-2.7',
u'/usr/local/lib/google_appengine_1.7.7/lib/webapp2-2.3',
u'/usr/local/lib/google_appengine_1.7.7/lib/webob-1.1.1',
u'/usr/local/lib/google_appengine_1.7.7/lib/yaml-3.10']
Server time: Wed, 24 Apr 2013 11:23:49 +0000
【问题讨论】: