def ssl(): from OpenSSL import SSL ctx = SSL.Context(SSL.SSLv23_METHOD) ctx.use_privatekey_file('ssl.key') ctx.use_certificate_file('ssl.cert') app.run(ssl_context=ctx)