From a99f63898f3726bb82ed803b08d0fe8a4d16bdea Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Wed, 10 Nov 2021 17:20:26 +1300 Subject: [PATCH] Update CORS url in django settings to use an env var --- backend/right_tree/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/right_tree/settings.py b/backend/right_tree/settings.py index e5cecaf..a567492 100644 --- a/backend/right_tree/settings.py +++ b/backend/right_tree/settings.py @@ -10,6 +10,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -136,7 +137,7 @@ STATIC_URL = '/static/' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' CORS_ALLOWED_ORIGINS = [ - 'http://localhost:3000' # Update this for production + os.getenv("FRONTEND_BASE_URL") or 'http://localhost:3000' ] CORS_ALLOW_HEADERS = [