I am reading the Flask documentation. I was told that with app.run(host='0.0.0.0')
, I could make the server publicly available.
What does it mean ? How can I visit the server in another computer (just localhost:5000
in my own computer) ?
I am reading the Flask documentation. I was told that with app.run(host='0.0.0.0')
, I could make the server publicly available.
What does it mean ? How can I visit the server in another computer (just localhost:5000
in my own computer) ?
To answer to your second question. You can just hit the IP address of the machine that your flask app is running, e.g. 192.168.1.100
in a browser on different machine on the same network and you are there. Though, you will not be able to access it if you are on a different network. Firewalls or VLans can cause you problems with reaching your application.
If that computer has a public IP, then you can hit that IP from anywhere on the planet and you will be able to reach the app. Usually this might impose some configuration, since most of the public servers are behind some sort of router or firewall.
192.168.1.100
to the web server. For nginx check here: nginx.org/en/docs/http/ngx_http_upstream_module.html. Let me know if you get stack.
0.0.0.0
is just a placeholder value to say "This isn't actually a real IP address I'm passing - just listen on ANY IP addresses on this host". The 0.0.0.0
terminology probably harkens back to a netmask setting of the same, which means similarly , "all ip addresses" (that's just a guess on my part though). See flask.palletsprojects.com/en/1.1.x/api/…