By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Hurdle in launching a Flask application on AWS Lightsail

0

The original project code is on VS Code. Pushed the application's image repository to DockerHub.com and from there pushed to AWS Lightsail.

Here is the status on Amazon CLI:

Last login: Mon Jun 17 10:13:58 2024 from 54.239.98.244
ubuntu@ip-172-26-15-239:~$ docker logs fcf0db26a49a
 * Serving Flask app 'app'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a p
roduction WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 107-751-001
 * Serving Flask app 'app'
 * Debug mode: on

Unable to figure out why nothing loading on http://127.0.0.1:5000. Since the static IP address for this instance is 44.206.118.123, also tried with http://44.206.118.123. But blank page.

If access to app.py file or any other files such as requirements.txt/DockerHub needed in order to troubleshoot, I will provide. Not providing just now for the sake of brevity.

The above project is just for display and not mission critical. As of now, my goal is to make the project live (can be viewed by anyone using the url or IP address).

profile picture
asked 6 months ago345 views
2 Answers
2
Accepted Answer

Hello,

I would recommend to check that your Flask app config app.py is configured to run on all network interfaces (0.0.0.0) and on the correct port (5000).

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)

You can follow this tutorial to deploy Flask application to Light Sail: https://aws.amazon.com/tutorials/serve-a-flask-app/

profile picture
EXPERT
answered 6 months ago
profile picture
EXPERT
reviewed 6 months ago
profile picture
EXPERT
reviewed 6 months ago
0

http://44.206.118.123:8080/ Same source code on AWS Lightsail (Ubuntu) showing internal server error once the form submitted though working fine on VS Studio (https://www.canva.com/design/DAGIZJrhyIk/EYzsYG5sfXMmEazS77EQ1w/edit?utm_content=DAGIZJrhyIk&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton).

profile picture
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions