From 85bda7af375cd03aa1923b78030a5a9d9d1a733d Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sun, 10 Dec 2023 02:33:01 -0500 Subject: [PATCH] settings: Add CI defaults --- runtests.py | 12 ++++++++---- settings.py | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/runtests.py b/runtests.py index 2e665c4..33df5e0 100644 --- a/runtests.py +++ b/runtests.py @@ -5,17 +5,20 @@ from django.conf import settings if not settings.configured: + ci = os.getenv('CI', False) + settings.configure( + SECRET_KEY='x', 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 '', + 'HOST': 'localhost', + 'NAME': 'postgres' if ci else 'represent_boundaries_test', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', 'PORT': os.getenv('PORT', 5432), } }, - ROOT_URLCONF='boundaries.urls', INSTALLED_APPS=( 'django.contrib.admin', 'django.contrib.auth', @@ -45,6 +48,7 @@ }, }, ], + ROOT_URLCONF='boundaries.urls', ) django.setup() diff --git a/settings.py b/settings.py index 2f258ef..08e2b97 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', + 'HOST': 'localhost', + 'NAME': 'postgres' if ci else 'represent_boundaries', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', + 'PORT': os.getenv('PORT', 5432), } }