Is there a way to generate a specific IP address or make a specific site of flask http://127.0.0.1:5000/ site which runs locally, to access the web-app made using flask from different device as by default it runs locally and under http://127.0.0.1:5000/ but,i want to access it from different devices.If,there's a way please help
refer first to this doc (section Externally Visible Server) on how to expose your local Flask
app to make it accessible from trusted devices in your network for testing purposes.
$(venv) flask run --host=0.0.0.0
or in your app.py
from flask import Flask
[..]
app = Flask(__name__)
[..]
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)
and then :
$(venv) python app.py
but if it happens and you got this error dial tcp 0.0.0.0:5000: connect: connection refused
then try to use the local ip address (192.168.x.y
instead of 0.0.0.0
) of the machine hosting your Flask
app. you may find this thread usefull
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With