mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-11 07:24:52 +03:00
Fallback to REDIS_URL when CELERY_BROKER_URL is missing
This commit is contained in:
parent
77a974d88d
commit
19cf1cd617
|
@ -45,7 +45,7 @@ LOCALE_PATHS = [str(BASE_DIR / "locale")]
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||||
try:
|
try:
|
||||||
{ % if cookiecutter.use_docker == "y" - %}
|
{%- if cookiecutter.use_docker == "y" %}
|
||||||
DATABASES = {"default": env.db("DATABASE_URL")}
|
DATABASES = {"default": env.db("DATABASE_URL")}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
|
@ -297,7 +297,11 @@ if USE_TZ:
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
|
||||||
CELERY_TIMEZONE = TIME_ZONE
|
CELERY_TIMEZONE = TIME_ZONE
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
|
||||||
|
try:
|
||||||
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
|
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
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
|
||||||
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended
|
||||||
|
|
Loading…
Reference in New Issue
Block a user