SSL 例子
# SSL 例子
可以传入 SSLContext:
import ssl
context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
context.load_cert_chain("/path/to/cert", keyfile="/path/to/keyfile")
app.run(host="0.0.0.0", port=8443, ssl=context)
1
2
3
4
5
2
3
4
5
你也可以用字典传入一个证书和密钥的位置:
ssl = {'cert': "/path/to/cert", 'key': "/path/to/keyfile"}
app.run(host="0.0.0.0", port=8443, ssl=ssl)
1
2
2
编辑 (opens new window)
上次更新: 2023/09/07, 12:09:00