diff --git a/backend/.profile b/backend/.profile index 51beb68820..75952618ad 100644 --- a/backend/.profile +++ b/backend/.profile @@ -54,4 +54,4 @@ if [[ "$CF_INSTANCE_INDEX" == 0 ]]; then fi # Make psql usable by scripts, for debugging, etc. -alias psql='/home/vcap/deps/0/apt/usr/lib/postgresql/*/bin/psql' +alias psql='/home/vcap/deps/0/apt/usr/lib/postgresql/*/bin/psql' \ No newline at end of file diff --git a/backend/config/settings.py b/backend/config/settings.py index 94158fcadb..1d740db156 100644 --- a/backend/config/settings.py +++ b/backend/config/settings.py @@ -174,11 +174,6 @@ # Database # https://docs.djangoproject.com/en/4.0/ref/settings/#databases -DATABASES = { - "default": env.dj_db_url( - "DATABASE_URL", default="postgres://postgres:password@0.0.0.0/backend" - ), -} POSTGREST = { "URL": env.str("POSTGREST_URL", "http://api:3000"), @@ -237,6 +232,13 @@ # Environment specific configurations DEBUG = False if ENVIRONMENT not in ["DEVELOPMENT", "PREVIEW", "STAGING", "PRODUCTION"]: + + DATABASES = { + "default": env.dj_db_url( + "DATABASE_URL", default="postgres://postgres:password@0.0.0.0/backend" + ), + } + # Local environment and Testing environment (CI/CD/GitHub Actions) if ENVIRONMENT == "LOCAL": @@ -284,6 +286,7 @@ # One of the Cloud.gov environments STATICFILES_STORAGE = "storages.backends.s3boto3.S3ManifestStaticStorage" DEFAULT_FILE_STORAGE = "report_submission.storages.S3PrivateStorage" + vcap = json.loads(env.str("VCAP_SERVICES")) DB_URL = get_db_url_from_vcap_services(vcap)