From 180a62fb5ef03315485dc7dde0d5d8990454906f Mon Sep 17 00:00:00 2001 From: Josue Gomez Date: Sat, 27 Jun 2020 11:00:33 -0600 Subject: [PATCH] database --- heroine/settings.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/heroine/settings.py b/heroine/settings.py index 120bcba..30d7dcd 100644 --- a/heroine/settings.py +++ b/heroine/settings.py @@ -79,15 +79,25 @@ WSGI_APPLICATION = 'heroine.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'portfolio', - 'USER': 'postgres', - 'PASSWORD':'rohitallu', - 'HOST':'localhost', +ENVIRONMENT = os.environ.get('ENVIRONMENT') +if ENVIRONMENT == 'production': + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } } -} +else: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'portfolio', + 'USER': 'postgres', + 'PASSWORD': 'rohitallu', + 'HOST': 'localhost', + } + } + # Password validation