Skip to content

Commit 5640fc0

Browse files
author
Mario Colombo
committed
simplify db setup
1 parent ebbcf93 commit 5640fc0

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

.env-local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DATABASE_URL=postgres://postgres@database_default:5432/db
1+
DATABASE_URL=postgres://postgres:password@database_default:5432/db
22
DEFAULT_STORAGE_DSN=file:///data/media/?url=%2Fmedia%2F
33
DJANGO_DEBUG=True
44
DOMAIN_ALIASES=localhost, 127.0.0.1

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ services:
2020
database_default:
2121
# Select one of the following db configurations for the database
2222
image: postgres:9.6-alpine
23+
ports:
24+
- "5432:5432" # allow your local dev env to connect to the db
2325
environment:
2426
POSTGRES_DB: "db"
27+
POSTGRES_PASSWORD: "password"
2528
POSTGRES_HOST_AUTH_METHOD: "trust"
2629
SERVICE_MANAGER: "fsm-postgres"
2730
volumes:

quickstart/settings.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,7 @@
141141
# Configure database using DATABASE_URL; fall back to sqlite in memory when no
142142
# environment variable is available, e.g. during Docker build
143143
DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite://:memory:')
144-
145-
if not os.environ.get('CI', False):
146-
DATABASES = {'default': dj_database_url.parse(DATABASE_URL)}
147-
else:
148-
DATABASES = {
149-
'default': {
150-
'ENGINE': 'django.db.backends.postgresql',
151-
'NAME': 'postgres',
152-
'USER': 'postgres',
153-
'PASSWORD': 'postgres',
154-
'HOST': '127.0.0.1',
155-
'PORT': '5432',
156-
}
157-
}
144+
DATABASES = {'default': dj_database_url.parse(DATABASE_URL)}
158145

159146

160147
# Password validation

0 commit comments

Comments
 (0)