Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

database setup in django aws

# in terminal, type
nano project_name/settings.py # remember to update Debug = False
# go to database section in settings.py
if RDS_DB_NAME in os.environ:
  DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': os.environ['RDS_DB_NAME'],
        'USER': os.environ['RDS_USERNAME']
        'PASSWORD': os.environ['RDS_PASSWORD'],
        'HOST': os.environ['RDS_HOSTNAME'],
        'PORT': os.environ['RDS_PORT'],
  	  }
	}
else:
  DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}
  
  
 
PREVIOUS NEXT
Tagged: #database #setup #django #aws
ADD COMMENT
Topic
Name
8+6 =