flask, raspberry pi, pi-hole - connection refused

I'm trying my hand at some development. I created a python flask ask that I am running on a raspberry pi (that is also running pi-hole).

I can reach the flask app locally with curl.

curl
>Hello, World!pi@hole:~/piapi/app $ 

But I cannot reach it from another host on the network:

curl
>curl: (7) Failed to connect to 192.168.0.2 port 5000: Connection refused

I assumed the port was blocked, but:

netstat -tupln | grep ':5000'
>tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 30171/python3 

That looks OK wrong to me~, and I can hit the pi-hole web app that runs on port 80. What am I doing wrong? Why can't I reach the flask app on port 5000?

1 Answer

I misunderstood how flask works. I ran flask from the command line flask run, and that ignored the host settings in the python file. Running the app with:

flask run --host=0.0.0.0

See this post for details:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like