SSL Example

Optionally pass in an SSLContext:

  1. import ssl
  2. context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
  3. context.load_cert_chain("/path/to/cert", keyfile="/path/to/keyfile")
  4.  
  5. app.run(host="0.0.0.0", port=8443, ssl=context)

You can also pass in the locations of a certificate and key as a dictionary:

  1. ssl = {'cert': "/path/to/cert", 'key': "/path/to/keyfile"}
  2. app.run(host="0.0.0.0", port=8443, ssl=ssl)

Related Topics

本页

快速搜索