From 81ff227a79c6c6cee5e06a991620d3ada53a64ef Mon Sep 17 00:00:00 2001 From: Clint Plummer Date: Sun, 18 Dec 2022 15:28:43 -0600 Subject: [PATCH] WIP --- backend/backend/settings.py | 38 ++++++++++++++++++------------------- backend/requirements.txt | 5 ++--- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/backend/backend/settings.py b/backend/backend/settings.py index 60c55ed..bed4fc6 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -17,7 +17,7 @@ # NOTE: https://github.com/joke2k/django-environ -import environ +# import environ # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -88,26 +88,26 @@ # Database # https://docs.djangoproject.com/en/4.1/ref/settings/#databases -DATABASES = { - 'default': dj_database_url.parse( - 'postgres://postgres:@127.0.0.1/pear-store' - ) -} +# DATABASES = { +# 'default': dj_database_url.parse( +# 'postgres://postgres:@127.0.0.1/pear-store' +# ) +# } # https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html#python-rds-connect -# import os - -# if 'RDS_HOSTNAME' in os.environ: -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.mysql', -# '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'], -# } -# } +import os + +if 'RDS_HOSTNAME' in os.environ: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + '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'], + } + } # Password validation diff --git a/backend/requirements.txt b/backend/requirements.txt index 7c9c59e..ca4c1c4 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,9 +1,8 @@ asgiref==3.5.2 Django==4.1.3 +django-cors-headers==3.13.0 +django-environ==0.9.0 djangorestframework==3.14.0 psycopg2==2.9.5 pytz==2022.6 sqlparse==0.4.3 -django-cors-headers==3.13.0 -dj-database-url==1.0.0 -django-environ==0.9.0