I can't connect to a Flask server from other devices(=not from localhost)
Try this
- app.run(host='0.0.0.0', debug=True)
- Allow TCP traffic on port 5000
- Turn off firewall
Please set the host in the python script to
host='0.0.0.0'
With that the Server will listen on all available network Interfaces.
You also have to assign your port (also in python):
port=5000
And take care, that your firewall is not blocking requests.To change the behavior of your firewall you can use (on windows) the integrated firewall tool. There you can also easily enable TCP traffic for port 5000 in your local network.
Sometimes it also happens that you have to enable peer to peer traffic in your local router.
Ps: you also have two slashes in your link
One way to access flask app from another computer is to get the host computer's IP and run it in another computer.
In Windows, go to cmd
and type ipconfig
and look for your computer ipv4 address E.g,192.168.0..
In Linux, use ifconfig
.
Then, in another machine,
http://<host_ipaddress>:<port>/<endpoint>
E.g, http://10.0.0.4:5000/sample