“ImportError: No module named _ssl” with dev_appserver.py from Google App Engine

后端 未结 7 1934
误落风尘
误落风尘 2020-11-27 13:55

Background

\"In the Python runtime, we\'ve added support for the Python SSL Library, so you can now open secure connections to remote servic

7条回答
  •  庸人自扰
    2020-11-27 14:20

    For the current GAE version (1.8.0 at least until 1.8.3), if you want to be able to debug SSL connections in your development environment, you will need to tweak a little bit the gae sandbox:

    • add "_ssl" and "_socket" keys to the dictionary _WHITE_LIST_C_MODULES in /path-to-gae-sdk/google/appengine/tools/devappserver2/python/sandbox.py
    • Replace the socket.py file provided by google in /path-to-gae-sdk/google/appengine/dis27 from the socket.py file from your Python framework.

    IMPORTANT: Tweaking the sandbox environment might end up with functionality working on your local machine but not in production (for example, GAE only supports outbound sockets in production). I will recommend you to restore your sandbox when you are done developing that specific part of your app.

提交回复
热议问题