如何强制gevent WSGIServer侦听HTTP和HTTPS

时间:2020-03-30 16:38:56

标签: python-3.x flask gevent gevent-socketio wsgiserver

我能够使用HTTPS访问该应用程序,但是在将其转换为https之后如何重定向它以侦听http。

当我尝试使用http访问它时,出现以下错误。

    ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:1056)
2020-03-30T15:58:35Z <Greenlet at 0x1d7ca90ce18: _handle_and_close_when_done(<bound method StreamServer.wrap_socket_and_handle , <bound method StreamServer.do_close of <WSGIServer, (<gevent._socket3.socket [closed]  object, fd=-1, )> failed with SSLError

我的run.py

from search_app import app
from gevent.pywsgi import WSGIServer
import os


if __name__ == '__main__':
    http_server = WSGIServer(('127.0.0.1', 5000), app, keyfile=f'{os.path.dirname(app.instance_path)}\\private.key', certfile=f'{os.path.dirname(app.instance_path)}\\xyz.crt')
    http_server.serve_forever()

0 个答案:

没有答案