简体   繁体   中英

How do I get my Python Flask app on an Ubuntu ec2 to connect with a MySQL db with RDS?

I am attempting to get my app to connect to my database on an RDS, also I am using NGINX. When connecting to the ec2 remotely using a terminal I can connect to the database there fine. It is on the public-facing side where the error exists. I followed a guide given to me by a coding school step by step. The initial login/registration page will load, but if I try to create an account or login error I get a 500 Internal service error. 500 错误

I set up my security group correctly as far as inbound rules go. Are there any outbound rules I need on the ec2 for it to be able to contact the RDS from the public ip?

Thank you

Note: I am not getting graded on this at this point, I already finished the Python stack, this is just something I still want to figure out. I don't like leaving something unfinished. I've taken the time and read many articles, watched videos, gone through AWS documentation and still cannot figure the issue out.

In this particular instance, the issue turned out to be that the database was not located on RDS, it was on the ec2 along with the flask app. I just needed to go into the mysqlconnection.py file and change the host to 'localhost', username to 'root', and the password.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM