Seawise
2022-06-01 08:13
采纳率: 100%
浏览 76
已结题

flask支持https失败了

问题遇到的现象和发生背景

微信小程序开发,接口需要是https的备案域名。
域名已经申请好,icp备案也做完了。
我是用python flask搭的系统,之前是http的。
卡在https 了, 找了几个教程 ,没弄出来,求手把手解决

服务器:阿里云centos 8.1
python 3.8.3
flask:1.1.2

问题相关代码,请勿粘贴截图

注释中是尝试过的代码,没成功


if __name__ == '__main__':
    # app.run(host='0.0.0.0', port=8080, debug=True, ssl_context=('guidaonongye.com_ca.crt', 'guidaonongye.com.key'))
    app.run(host='0.0.0.0', port=8080, debug=True)

运行结果及报错内容
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/werkzeug/serving.py", line 957, in inner
    srv = make_server(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/werkzeug/serving.py", line 789, in make_server
    return ThreadedWSGIServer(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/werkzeug/serving.py", line 709, in __init__
    ssl_context = load_ssl_context(*ssl_context)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/werkzeug/serving.py", line 602, in load_ssl_context
    ctx.load_cert_chain(cert_file, pkey_file)
ssl.SSLError: [X509: KEY_VALUES_MISMATCH] key values mismatch (_ssl.c:4012)


我的解答思路和尝试过的方法

这个是站长之家的证书
https://www.bilibili.com/video/BV1P3411h7je?spm_id_from=333.880.my_history.page.click

阿里云的证书也试过,没成功

我想要达到的结果

微信小程序可正常使用该接口

4条回答 默认 最新

相关推荐 更多相似问题