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
demandé il y a 7 mois370 vues
2 réponses
2
Réponse acceptée

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
répondu il y a 7 mois
profile picture
EXPERT
vérifié il y a 7 mois
profile picture
EXPERT
vérifié il y a 7 mois
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
répondu il y a 7 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions