PostgreSQL backend support

This commit is contained in:
clime
2018-07-10 10:15:05 +02:00
parent 8a877aac9f
commit a4cb44ea79
2 changed files with 46 additions and 18 deletions

View File

@@ -108,6 +108,7 @@ try:
from ivatar.settings import DATABASES
except Exception: # pragma: no cover
DATABASES = [] # pragma: no cover
if 'default' not in DATABASES:
DATABASES['default'] = { # pragma: no cover
'ENGINE': 'django.db.backends.sqlite3',
@@ -123,5 +124,14 @@ if 'MYSQL_DATABASE' in os.environ:
'HOST': 'mysql',
}
if 'POSTGRESQL_DATABASE' in os.environ:
DATABASES['default'] = { # pragma: no cover
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['POSTGRESQL_DATABASE'],
'USER': os.environ['POSTGRESQL_USER'],
'PASSWORD': os.environ['POSTGRESQL_PASSWORD'],
'HOST': 'postgresql',
}
if os.path.isfile(os.path.join(BASE_DIR, 'config_local.py')):
from config_local import * # noqa # flake8: noqa # NOQA # pragma: no cover