make the database cookiecutter connection and use of .env in that regard more clear for #490 and #270

This commit is contained in:
Nathan Victor 2017-07-26 16:46:17 -05:00
parent aaa9800ba8
commit 1f0e055e67
2 changed files with 11 additions and 3 deletions

View File

@ -109,7 +109,15 @@ MANAGERS = ADMINS
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}'),
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}',
'USER': env.db('DATABASE_USER', default=''),
'PASSWORD': env.db('DATABASE_PASSWORD', default=''),
'HOST': '127.0.0.1',
'PORT': '',
'CONN_MAX_AGE': 0
}
}
DATABASES['default']['ATOMIC_REQUESTS'] = True

View File

@ -1,7 +1,7 @@
# PostgreSQL
POSTGRES_PASSWORD=mysecretpass
POSTGRES_USER=postgresuser
DATABASE_PASSWORD=mysecretpass
DATABASE_USER=postgresuser
# General settings
# DJANGO_READ_DOT_ENV_FILE=True