Skip to content

Commit

Permalink
chore: Update settings.py for django-admin commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jun 26, 2024
1 parent 1dca8a6 commit 4416e62
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
@@ -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),
}
}

Expand All @@ -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')

0 comments on commit 4416e62

Please sign in to comment.