Flask port 5000 blocked

Posted May 21, 2017 19.3k views
PythonUbuntu 16.04

I am running the Flask tutorial here:

and have set my ufw permissions like so:

sudo ufw allow 5000/tcp

but am still not seeing anything

If I login into a seperate session, and do:

curl localhost:5000

I see the website.

Any suggestions?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Try running ufw disable to disable the firewall, then attempt to connect. If you’re able to connect with the firewall down, you may need to reset and reconfigure the firewall.

We can do that by running the following commands, after the above command:

ufw reset
ufw default deny incoming
ufw default allow outgoing

Now we need to at least allow ports 22 and 5000 in, so we’ll go ahead and add those first:

ufw allow 22/tcp
ufw allow 5000/tcp

Once you’ve ran each of those commands, we’ll re-enable ufw:

ufw enable

Make sure you allow port 22 – not allowing that port means you won’t be able to SSH in, thus you’d either be locked out (if you’re using SSH Keys) or would need to access the console (if you’re using passwords).

@jtittle thanks for the help. I mistakingly setup iptables following the 14.04 instructions. I flushed those and am all good now. Thanks!