Home:ALL Converter>How to run a Flask app on CherryPy WSGI server (Cheroot) using HTTPS?

How to run a Flask app on CherryPy WSGI server (Cheroot) using HTTPS?

Ask Time:2019-03-27T05:23:06         Author:Kay

Json Formatter

I am running a Python 2.7 Flask app on CherryPy Cheroot WSGI server usinh HTTP now as below.

from cheroot.wsgi import Server as WSGIServer
from cheroot.wsgi import PathInfoDispatcher as WSGIPathInfoDispatcher

from MyFlaskApp import app

d = WSGIPathInfoDispatcher({'/': app})
server = WSGIServer(('0.0.0.0', 80), d)

if __name__ == '__main__':
   try:
      server.start()
   except KeyboardInterrupt:
      server.stop()

What would I have to to move to HTTPS from here? I found below instruction, but it does not seem to applicable to my application.

from cheroot.server import HTTPServer
from cheroot.ssl.builtin import BuiltinSSLAdapter

HTTPServer.ssl_adapter = BuiltinSSLAdapter(
        certificate='cert/domain.crt', 
        private_key='cert/domain.key')

Can I apply above sample to my Flask app on Cheroot? If not, what would be a simple example for Flask app on Cheroot for HTTPS?

Author:Kay,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55366395/how-to-run-a-flask-app-on-cherrypy-wsgi-server-cheroot-using-https
yy