diff --git a/runtests.py b/runtests.py index 2e665c4..f6807fa 100644 --- a/runtests.py +++ b/runtests.py @@ -5,13 +5,16 @@ from django.conf import settings if not settings.configured: + ci = os.getenv('CI', False) + settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'postgres' if os.getenv('CI', False) else 'represent_boundaries_test', - 'USER': 'postgres' if os.getenv('CI', False) else '', - 'PASSWORD': 'postgres' if os.getenv('CI', False) else '', + 'NAME': 'postgres' if ci else 'represent_boundaries_test', + 'HOST': 'postgres' if ci else 'localhost', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', 'PORT': os.getenv('PORT', 5432), } }, diff --git a/settings.py b/settings.py index 2f258ef..403f35c 100644 --- a/settings.py +++ b/settings.py @@ -3,12 +3,18 @@ """ import os +ci = os.getenv('CI', False) + SECRET_KEY = 'x' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'represent_boundaries', + 'NAME': 'postgres' if ci else 'represent_boundaries', + 'HOST': 'postgres' if ci else 'localhost', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', + 'PORT': os.getenv('PORT', 5432), } }