Question: Hi I'm trying to write a code for a web server in python with flask. This is what I have so far from flask import

Hi I'm trying to write a code for a web server in python with flask. This is what I have so far

from flask import Flask app = Flask(__name__) @app.route('/') #first endpoint i.e. "http://localhost/" def index(): return 'hello' #return data in string if __name__ == '__main__': app.run(debug=True)

After running the code, I'm given a address to the web with the text hello. The problem is that this only works with my computer that is running the code. If I try to enter this address into my phone's browser it will show up as connection refused. How do I fix this so that I can get a Python Web Server with a address that will show 'hello' on any device.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!