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? flask flask

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


I figured out the necessary modification.Not much information on Flask app on Cheroot with https, so I thought I'd share it.

from cheroot.wsgi import Server as WSGIServerfrom cheroot.wsgi import PathInfoDispatcher as WSGIPathInfoDispatcherfrom cheroot.ssl.builtin import BuiltinSSLAdapterfrom MyFlaskApp import appmy_app = WSGIPathInfoDispatcher({'/': app})server = WSGIServer(('0.0.0.0', 443), my_app)ssl_cert = "[path]/myapp.crt"ssl_key = "[path]/myapp.key"server.ssl_adapter =  BuiltinSSLAdapter(ssl_cert, ssl_key, None)if __name__ == '__main__':   try:      server.start()   except KeyboardInterrupt:      server.stop()