Run Flask dev server over HTTPS using CLI

后端 未结 2 1008
暗喜
暗喜 2021-01-12 10:31

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 ar

相关标签:
2条回答
  • 2021-01-12 11:25

    I would personally use something like ngrok to create secure tunnels to localhost. Like davidism stated the dev server isn't meant for production but if you want see how your app behaves and/or your app requires SSL (like FlaskAsk apps for example) ngrok is the probably the easiest way.

    0 讨论(0)
  • 2021-01-12 11:35

    This will be available when Flask 1.0 is released.

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

    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.

    0 讨论(0)
提交回复
热议问题