使用CLI通过HTTPS运行Flask开发服务器 [英] Run Flask dev server over HTTPS using CLI

查看:58
本文介绍了使用CLI通过HTTPS运行Flask开发服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用flask命令通过HTTPS服务Flask应用程序.我可以通过传递ssl_context参数来使用app.run来做到这一点,但是我不知道如何在CLI上做到这一点.

I am trying to serve a Flask application over HTTPS using the flask command. I can do this using app.run by passing the ssl_context argument, but I can't figure out how to do this on the CLI.

flask run --host='0.0.0.0' --port=80

推荐答案

在Flask上可用1.0已发布.

flask run --cert dev.crt --key dev.key

在此之前,如果确实需要,请使用app.run.请记住,开发服务器不是用于生产的,并且通常不应公开访问,因此SSL不应引起太大的关注.

Until then, use app.run if you really need this. Keep in mind that the dev server is not meant for production and should typically not be accessible publicly, so SSL shouldn't be as big a concern.

这篇关于使用CLI通过HTTPS运行Flask开发服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆