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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则