mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-11 08:32:21 +03:00
Unconditionally connect to database from DATABASE_URL env when opting for Docker
Closes #1541.
This commit is contained in:
parent
0311732ce3
commit
6c26d39f65
|
@ -110,9 +110,15 @@ MANAGERS = ADMINS
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||||
# Uses django-environ to accept uri format
|
# Uses django-environ to accept uri format
|
||||||
# See: https://django-environ.readthedocs.io/en/latest/#supported-types
|
# See: https://django-environ.readthedocs.io/en/latest/#supported-types
|
||||||
|
{% if cookiecutter.use_docker == 'y' %}
|
||||||
|
DATABASES = {
|
||||||
|
'default': env.db('DATABASE_URL'),
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}'),
|
'default': env.db('DATABASE_URL', default='postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}'),
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
DATABASES['default']['ATOMIC_REQUESTS'] = True
|
DATABASES['default']['ATOMIC_REQUESTS'] = True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user