I write code on my local machine and then use github to transfer the code to my Amazon AWS EC2 server, I am using AWS Route53 to connect to a domain name and AWS RDS for database (started using recently, few days ago).
In my previous code I was using Hostinger's remote mysql capability for a hosted database which was working fine, I deployed the code on AWS EC2 server and tested, however, when I created MySql database using RDS and updated its details in the settings.py the application is still being run using the old Hostinger's database settings only.
I have tried the following things:
- deleting all the cache files,
- removing all migrations files and creating migrations once again,
- checked settings.py (database configuration settings) multiple times
- Restarted the EC2 instance, restarted supervisor, gunicorn, nginx
- Deleted the RDS database and created one more and updated its respective settings in settings.py
To my surprise, for some reason it is still working on the old database, I am not able to figure out where exactly is it picking up the details of the old database and why is the latest settings.py file not being loaded in real time?
manage.pyfile and check for a line like thisos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'YOUR_PROJECT_NAME.settings')YOUR_PROJECT_NAME should be correct here. Then runpython manage.py runserver 0.0.0.0:8000instead of gunicorn and see if its taking the right settings.py