Fix REDIS_URL missing

Fixes #1570.
This commit is contained in:
Nikita P. Shupeyko 2018-04-04 13:42:01 +03:00
parent ae9dc2e782
commit 26ccf9307f
4 changed files with 12 additions and 10 deletions

View File

@ -1,8 +1,7 @@
# General
# ------------------------------------------------------------------------------
USE_DOCKER=yes
{% if cookiecutter.use_celery == "y" %}
# Celery
# Redis
# ------------------------------------------------------------------------------
CELERY_BROKER_URL=redis://redis:6379/0
{% endif %}
REDIS_URL=redis://redis:6379/0

View File

@ -16,11 +16,7 @@ DJANGO_SECURE_SSL_REDIRECT=False
MAILGUN_API_KEY=
DJANGO_SERVER_EMAIL=
MAILGUN_DOMAIN=
{% if cookiecutter.use_celery == "y" %}
# Celery
# ------------------------------------------------------------------------------
CELERY_BROKER_URL=redis://redis:6379/0
{% endif %}
# AWS
# ------------------------------------------------------------------------------
DJANGO_AWS_ACCESS_KEY_ID=
@ -43,3 +39,7 @@ WEB_CONCURRENCY=4
# ------------------------------------------------------------------------------
DJANGO_SENTRY_DSN=
{% endif %}
# Redis
# ------------------------------------------------------------------------------
REDIS_URL=redis://redis:6379/0

View File

@ -7,6 +7,9 @@ set -o nounset
cmd="$@"
# N.B. If only .env files supported variable expansion...
export CELERY_BROKER_URL="${REDIS_URL}"
if [ -z "${POSTGRES_USER}" ]; then
base_postgres_image_default_user='postgres'
export POSTGRES_USER="${base_postgres_image_default_user}"

View File

@ -21,7 +21,7 @@ DATABASES['default']['CONN_MAX_AGE'] = env.int('CONN_MAX_AGE', default=60) # no
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': f'{env("REDIS_URL", default="redis://127.0.0.1:6379")}/{0}',
'LOCATION': env('REDIS_URL'),
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
# Mimicing memcache behavior.