currently I am working on a web app development and I am running my server on an Amazon ec2 instance. I am testing my (web app which uses Flask) by running the server on localhost:5000 as usual. However I don't have access to the gui hence I don't see my app and test it like I would do on a browser. I have a Mac OS X computer so my question is how can I see the localhost of Amazon EC2 from my mac's browser ?
You need to tell the Flask Dev webserver to run on 0.0.0.0
instead of localhost
.
You specify this option when calling the .run()
function:
app.run(host='0.0.0.0', debug=True, port=5000)
If you then send a request to the Public IP of your EC2 instance on port 5000 you will reach your Flask Dev webserver.
eg: http://EC2_IP:5000/
Hope this helps :)
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