Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask 0.11 CLI dev server -- specify host?

Tags:

flask

With Flask 0.11 it is highly recommend to run the dev server from the command line, however, I cannot figure out how to change the host. I need to access this externally so previously I used app.run(host="0.0.0.0") which worked fine, but I can't find the equivalent for running this from the command line. I tried setting app.config["SERVER_NAME"] = "0.0.0.0" but the dev server isn't picking this up.

like image 315
Brandon Avatar asked Jun 03 '16 14:06

Brandon


People also ask

How do I assign a host in flask?

Another thing you can do is use the flask executable to start your server, you can use flask run --host=0.0. 0.0 to change the default IP which is 127.0. 0.1 and open it up to non local connections.

How do I run a flask on local host?

To install flask, simply type in pip install flask in your computer terminal/command line. Once you have made sure flask is installed, simply run the hello.py script. Once you run the script, the website should now be up and running on your local machine, and it can be viewed by visiting localhost:5000 in your browser.


1 Answers

You can run with --host option

flask run --host='0.0.0.0'

To see all available options

flask run --help
like image 60
r-m-n Avatar answered Oct 21 '22 22:10

r-m-n