Skip to content

Commit

Permalink
Fallback to REDIS_URL when CELERY_BROKER_URL is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
foarsitter committed Jan 27, 2024
1 parent 77a974d commit 0ae5d90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions {{cookiecutter.project_slug}}/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
# ------------------------------------------------------------------------------
# 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 %}
{%- else %}
DATABASES = {
"default": env.db(
"DATABASE_URL",
default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}",
),
}
{ % - endif %}
{%- endif %}
except environ.ImproperlyConfigured:
DATABASES = {
"default": {
Expand Down Expand Up @@ -297,7 +297,7 @@
# 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
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
CELERY_BROKER_URL = env("CELERY_BROKER_URL", default=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
Expand Down

0 comments on commit 0ae5d90

Please sign in to comment.