-2

I am trying to run simple hello world flask application. I followed all the steps mentioned here as I am using Ubuntu 18.04.5 LTS.

When I execute command flask run, I got following output:

Flask Run

But I am not able to get application run even after visiting the address http://10.142.0.2:5000. Tried using another IP address as well.

Opened port 5000, but not able to see in the list of open ports. Tried setting new firewall rule through GCP console as well.

Stack User
  • 19
  • 1
  • 5

2 Answers2

0

Are you trying to access your web app from another machine? That won't work because 127.0.0.1 means localhost. Try

flask run --host=0.0.0.0

This will tell flask to listen on all interfaces and not only the loopback address.

See https://flask.palletsprojects.com/en/latest/quickstart/#public-server for details.

Selcuk
  • 57,004
  • 12
  • 102
  • 110
0

If you are connecting via ssh you can use Gunicorn with nginx as a server. Note: They are running in the background(you can use the terminal when they are running.)

If you are trying to remove the port number you can change the port as 80