gevent flask https ssl wsgi
转自: http://stackoverflow.com/questions/19109436/gevent-ssl-wsgiserver-blocks-when-it-shouldnt
import gevent import gevent.monkey gevent.monkey.patch_all() import requests from gevent.pywsgi import WSGIServer from flask import Flask app = Flask(__name__) app.debug = True # Simple catch-all server @app.route('/', defaults={'path': ''}, methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST']) def catch_all(path): return 'It is Working!' if __name__ == '__main__': http_server = WSGIServer(('', 4430), app, keyfile='server.key', certfile='server.crt') srv_greenlet = gevent.spawn(http_server.start) gevent.sleep(0.5) resp = requests.get('https://127.0.0.1:4430/') print resp.text http_server.stop() gevent.joinall([srv_greenlet])