0

I ran a Flask app on a web server, and got the expected reply:

Running on http://127.0.0.1:5000

When I open the link locally, e.g. with lynx http://127.0.0.1:5000, I get the expected reply - I see the main page of my app.

But when I open the link remotely, e.g. by pointing my browser to http://my.ip.address:5000, I get an error Unable to connect.

WHAT I TRIED:

  • I thought maybe the ip address I entered is incorrect, but I verified with ifconfig that it is correct.
  • I thought it is related to the firewall,so I disabled it with ufw disable. But the problem remained.
  • netstat -anltp | grep LISTEN returns:
    tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      1316492/mysqld
    tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      1317391/python
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1316492/mysqld
    tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      603/systemd-resolve
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      771/sshd: /usr/sbin
    tcp6       0      0 :::80                   :::*                    LISTEN      178532/apache2
    tcp6       0      0 :::22                   :::*                    LISTEN      771/sshd: /usr/sbin
    tcp6       0      0 :::443                  :::*                    LISTEN      178532/apache2

So I do see that python listens on port 5000.

What should I do to be able to open my Flask app remotely?

Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183

0 Answers0