Bruce Pucci
Bruce Pucci

Reputation: 115

Run Flask dev server over HTTPS using 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

Upvotes: 10

Views: 11888

Answers (2)

BrettJ
BrettJ

Reputation: 1226

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.

Upvotes: 4

davidism
davidism

Reputation: 127180

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.

Upvotes: 18

Related Questions