3

With the help of the post Flask - configure dev server to be visible across the network, I have tried the same to make my Flask externally visible so that I can send HTTP requests from my local browser to the Flask in remote server.

Can someone please help on why its not working for me even I have opened the connections. I started my flask in Putty [script in dev server] and tried accessing the URL from my Chrome as http://[my_sys_ip]:5000/. Chrome reports me OOPS error.

On Flask, I have made it externally visble with debug mode turned off:

 if __name__ == '__main__':
    app.run(host='0.0.0.0', debug = False)

From netstat, I can see its listening on 5000:

netstat -an | grep :5000
tcp        0      0 0.0.0.0:5000                0.0.0.0:*                   LISTEN

When tried to send a GET request from the same dev server, I'm successful with the expected response:

python testing.py
URL called is http://0.0.0.0:5000/
Message to the user is Hello World!!!!!!!

What am I missing ?

Community
  • 1
  • 1
Sathy
  • 303
  • 2
  • 8
  • 18
  • Is the remote server within the same local network as the computer running chrome? Just guessing: If not, than the remote server is probably behind a router and that's probably where the connection to port 5000 is blocked. – sebastian Sep 05 '13 at 08:15
  • What is the IP address you are connecting too? It is a publicly routable address isn't it? – Joe Doherty Sep 05 '13 at 08:17
  • @sebastian Yes they are on the same network. – Sathy Sep 05 '13 at 12:01
  • @JoeDoherty Please help to understand "publicly routable address" – Sathy Sep 05 '13 at 12:01
  • If they are on the same network that should be fine. I was meaning if you were running from another network and trying to conenct to 192.168.1.0\24 or something. I would check routing/firewalling if you are having trouble connecting between them. Are you connecting to this other box on the same IP as you are trying to connect? – Joe Doherty Sep 05 '13 at 12:14
  • No I was using my localhost – Sathy Sep 05 '13 at 13:30
  • Any chance you have a firewall running on the computer that is running the flask server? – Miguel Grinberg Sep 06 '13 at 03:22

1 Answers1

1

I know this is an old question, but I figured I'll throw my 2 cents in.

From your description, it sounds like you are launching your flask application on a remote server (dev server) through PuTTY. You are then trying to access the app on your local system (localhost). The application isn't running on your local system, so that would explain the error in chrome.

Instead of going to http://[my_sys_ip]:5000, you will need to go to http://[dev_svr_ip]:5000.

pferate
  • 2,067
  • 1
  • 16
  • 18