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
已提問 7 個月前檢視次數 368 次
2 個答案
2
已接受的答案

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
專家
已回答 7 個月前
profile picture
專家
已審閱 7 個月前
profile picture
專家
已審閱 7 個月前
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
已回答 7 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南