24π
β
All you need to do before doing the normal migration documented in the official tutorial is to be sure to have your RDS instance available and accessible to your EC2 instance.
Then, what you need to do is to modify the settings.py
file of your app in the DATABASES
section in the following way:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '<name defined upon RDS creation>',
'USER': '<username defined upon RDS creation>',
'PASSWORD': '<password defined upon RDS creation>',
'HOST': '<this can be found in "Endpoint" on your RDS dashboard, exclude the ":" and the port number>',
'PORT': '5432',
}
}
Following this, continue to migrate normally and all should work well.
π€bluesummers
0π
If you are able to use a deployment service, take a look at at AWS Elastic Beanstalk. It combines EC2, RDS and S3 storage into a Docker and helps keep them together. Itβs really easy to connect your RDS instance to your EC2 instance(s). I just launched a Django project using that a few weeks ago.
π€awwester
- Is it possible to create subparsers in a django management command?
- Forbidden (403) CSRF verification failed. Request aborted
- How to display "x days ago" type time using Humanize in Django template?
Source:stackexchange.com