diff --git a/settings.py b/settings.py index 63dc807..e231b2c 100644 --- a/settings.py +++ b/settings.py @@ -1,13 +1,20 @@ """ -To run `PYTHONPATH=$PYTHONPATH:$PWD django-admin.py migrate --settings settings --noinput`. +To run: env PYTHONPATH=$PWD DJANGO_SETTINGS_MODULE=settings django-admin migrate --noinput """ +import os + +ci = os.getenv('CI', False) SECRET_KEY = 'x' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'travis_ci_test', + 'HOST': 'localhost', + 'NAME': 'postgres' if ci else 'represent', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', + 'PORT': os.getenv('PORT', 5432), } } @@ -16,6 +23,37 @@ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.gis', + 'django.contrib.messages', 'boundaries', 'postcodes', + 'representatives', ) + +MIDDLEWARE = [ + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +] + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +if 'GDAL_LIBRARY_PATH' in os.environ: + GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH') +if 'GEOS_LIBRARY_PATH' in os.environ: + GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')