这也适用于紧要关头
from flask import Flask, jsonifyfrom OpenSSL import SSLcontext = SSL.Context(SSL.PROTOCOL_TLSv1_2)context.use_privatekey_file('server.key')context.use_certificate_file('server.crt')app = Flask(__name__)@app.route('/')def index(): return 'Flask is running!'@app.route('/data')def names(): data = {"names": ["John", "Jacob", "Julie", "Jennifer"]} return jsonify(data)#if __name__ == '__main__':# app.run()if __name__ == '__main__': app.run(host='127.0.0.1', debug=True, ssl_context=context)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)