Q:

Python Flask application not accessible from remote machine

Hi All I am new to Python Flask. After reading basic manuals I tried to create a sample Flask application and successfully did in my machine.
My code (taken from various tutorials) is given below:
from flask import Flask

app = Flask(__name__)

@app.route("/")
def main():
    return "Welcome!"

if __name__ == "__main__":
    app.run()

As you can understand, this application prints "Welcome!" whenever I hit http://127.0.0.1:5000/. But when I try to access the application from some other machine within same network by replacing 127.0.0.1 with my system's IP address, I am getting "Network Error (tcp_error) Connection Refused" error
Any inputs on how to access Flask application (created in one machine) from another machine will be helpful

A:

Finally after hitting several other tutorials, I am able to access my application from remote machines as well.
The problem is if we just run the Flask app by "app.run()" command then it will listen only to the localhost / 127.0.0.1 . If we make the app listen everywhere by running it using "app.run(host= '0.0.0.0')" then I am able to access it even from other machines
Hope others also will get benefited with this.
Reference : http://dixu.me/2015/10/26/How_to_Allow_Remote_Connections_to_Flask_Web_Service/

