Skip to content

Commit

Permalink
Move .env to .env.development and update settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtitherington committed Nov 3, 2023
1 parent 92b5d75 commit 61c87ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
File renamed without changes.
12 changes: 8 additions & 4 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
from dotenv import load_dotenv
import os

LOAD_DOTENV = os.getenv("LOAD_DOTENV", "True") == "True"
if LOAD_DOTENV:
load_dotenv()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

ENVIRONMENT = os.getenv('ENVIRONMENT', 'development') # Assume development by default
if ENVIRONMENT == 'production':
dotenv_path = BASE_DIR / '.env.production'
else:
dotenv_path = BASE_DIR / '.env.development'

if dotenv_path.exists():
load_dotenv(dotenv_path=dotenv_path)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
Expand Down

0 comments on commit 61c87ac

Please sign in to comment.