Fallback to REDIS_URL when CELERY_BROKER_URL is missing

This commit is contained in:
Jelmer Draaijer 2024-01-27 12:24:36 +01:00
parent 77a974d88d
commit 19cf1cd617

View File

@ -45,7 +45,7 @@ LOCALE_PATHS = [str(BASE_DIR / "locale")]
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
try:
{ % if cookiecutter.use_docker == "y" - %}
{%- if cookiecutter.use_docker == "y" %}
DATABASES = {"default": env.db("DATABASE_URL")}
{%- else %}
DATABASES = {
@ -297,7 +297,11 @@ if USE_TZ:
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
CELERY_TIMEZONE = TIME_ZONE
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
try:
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
except environ.ImproperlyConfigured:
CELERY_BROKER_URL = env("REDIS_URL")
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended