Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
807 views
in Technique[技术] by (71.8m points)

openssl - "ImportError: No module named _ssl" with dev_appserver.py from Google App Engine


Background

"In the Python runtime, we've added support for the Python SSL Library, so you can now open secure connections to remote services such as Apple's Push Notification service."

This quote is taken from a recent post on the Google App Engine blog.


Implementation

If you want to use native python ssl, you must enable it using the libraries configuration in your application's app.yaml file where you specify the library name "ssl" . . .

These instructions are provided for developers through the Google App Engine documentation.

The following lines have been added to the app.yaml file:

libraries:
- name: ssl
  version: latest

This much is in line with the advice provided through the Google App Engine documentation.


Problem

I have tried running my project in three different configurations. Two are working, and one is not.

Working ...

After I upload my application to Google App Engine, and run my project through the live server, everything works fine.

Working ...

When I run my project with manage.py runserver and include the Google App Engine SKD in my PYTHONPATH, everything works fine.

Not Working ...

However, when I run my project with dev_appserver.py, I get the following error:

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...