added debug if/else

This commit is contained in:
Rushil Umaretiya 2020-09-21 19:21:56 -04:00
parent 00b225b008
commit 857a9aae9e

View File

@ -25,7 +25,10 @@ SECRET_KEY = secrets.SECRET_KEY
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = False
ALLOWED_HOSTS = ['hilo.link'] if DEBUG:
ALLOWED_HOSTS = ['*']
else:
ALLOWED_HOSTS = ['hilo.link', 'hi-loproject.com']
# Application definition # Application definition
@ -79,7 +82,8 @@ WSGI_APPLICATION = 'config.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = { if not DEBUG:
DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': secrets.DB_NAME, 'NAME': secrets.DB_NAME,
@ -88,9 +92,14 @@ DATABASES = {
'HOST': 'localhost', 'HOST': 'localhost',
'PORT': '', 'PORT': '',
} }
} }
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
# Password validation # Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators