Reputation: 6893
From most of the resources, I gathered-
If I declare 0.0.0.0 as host and 5000 as port explicitly,other devices under my wifi network should access it, but when I type http://0.0.0.0:5000/
from another machine(my windows laptop), it didn't work.
port 5000 needs to be open. If not then I should open that. That didn't work for me either.
Perhaps debug=True
parameter should be removed from Flask's run()
method as dev server shouldn't be publicly available. Still no luck!
What else could be the problem as the following isn't working for me-
app.run(host='0.0.0.0', port=5000)
I know, this question has been asked couple of times, but none of the suggestions worked for me. So, please help me access my flask Restful API through other devices as I want to test the service having a web application and mobile application as clients.
Upvotes: 3
Views: 3546
Reputation: 779
The Flask dev server should not be used in production as it is not designed to be efficient and secure. Flask Deployment
To make the flask dev server visible on LAN/WLAN add the host
parameter to run on machine's IP Address
app.run(host='0.0.0.0', port=5000)
To Access the web server use private ip address(LAN/WLAN) of the machine running the flask server 192.168.1.23:5000
Upvotes: 4