liv a
liv a

Reputation: 3340

running a web application on GCE instance re

Following this tutorial, I'm learning how to create a RESTful python service using virtualenv and flask

I've created a small hello world web application and executed it: ./app.py. This resulted in:

* Running on http://127.0.0.1:5000/
* Restarting with reloader

But when I open the browser and enter http://<external ip>:5000, instead of seeing hello world I get:

could not connect to <external ip>:5000

What am I missing?

Upvotes: 1

Views: 616

Answers (1)

Miguel Grinberg
Miguel Grinberg

Reputation: 67479

What you are missing is clearly stated by this message:

Running on http://127.0.0.1:5000/

The server is listening on the localhost address only, so it will not see connections from other machines. If you want to make the server listen on the public interface you need to change the app.run() line as follows:

app.run(host = '0.0.0.0', debug = True)

Upvotes: 3

Related Questions