Made DATABASE_URL parsing conditional
This commit is contained in:
parent
e5b330c8c4
commit
f562c8057f
10
settings.py
10
settings.py
@ -4,11 +4,13 @@ import dj_database_url
|
|||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': dj_database_url.config(default=DATABASE_URL)
|
|
||||||
}
|
|
||||||
|
|
||||||
if not DATABASE_URL:
|
DATABASES = {}
|
||||||
|
|
||||||
|
if DATABASE_URL:
|
||||||
|
# Reads string from DATABASE_URL env by default
|
||||||
|
DATABASES['default'] = dj_database_url.config()
|
||||||
|
else:
|
||||||
DATABASES['default'] = {
|
DATABASES['default'] = {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': DATABASE_NAME,
|
'NAME': DATABASE_NAME,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user