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.
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.
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.
You can run with --host
option
flask run --host='0.0.0.0'
To see all available options
flask run --help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With