Skip to content

Commit 4416e62

Browse files
committed
chore: Update settings.py for django-admin commands
1 parent 1dca8a6 commit 4416e62

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

settings.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
"""
2-
To run `PYTHONPATH=$PYTHONPATH:$PWD django-admin.py migrate --settings settings --noinput`.
2+
To run: env PYTHONPATH=$PWD DJANGO_SETTINGS_MODULE=settings django-admin migrate --noinput
33
"""
4+
import os
5+
6+
ci = os.getenv('CI', False)
47

58
SECRET_KEY = 'x'
69

710
DATABASES = {
811
'default': {
912
'ENGINE': 'django.contrib.gis.db.backends.postgis',
10-
'NAME': 'travis_ci_test',
13+
'HOST': 'localhost',
14+
'NAME': 'postgres' if ci else 'represent',
15+
'USER': 'postgres' if ci else '',
16+
'PASSWORD': 'postgres' if ci else '',
17+
'PORT': os.getenv('PORT', 5432),
1118
}
1219
}
1320

@@ -16,6 +23,37 @@
1623
'django.contrib.auth',
1724
'django.contrib.contenttypes',
1825
'django.contrib.gis',
26+
'django.contrib.messages',
1927
'boundaries',
2028
'postcodes',
29+
'representatives',
2130
)
31+
32+
MIDDLEWARE = [
33+
'django.contrib.sessions.middleware.SessionMiddleware',
34+
'django.contrib.auth.middleware.AuthenticationMiddleware',
35+
'django.contrib.messages.middleware.MessageMiddleware',
36+
]
37+
38+
TEMPLATES = [
39+
{
40+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
41+
'DIRS': [],
42+
'APP_DIRS': True,
43+
'OPTIONS': {
44+
'context_processors': [
45+
'django.template.context_processors.debug',
46+
'django.template.context_processors.request',
47+
'django.contrib.auth.context_processors.auth',
48+
'django.contrib.messages.context_processors.messages',
49+
],
50+
},
51+
},
52+
]
53+
54+
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
55+
56+
if 'GDAL_LIBRARY_PATH' in os.environ:
57+
GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')
58+
if 'GEOS_LIBRARY_PATH' in os.environ:
59+
GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')

0 commit comments

Comments
 (0)