Skip to content

Commit 9c70d0a

Browse files
committed
Fallback to REDIS_URL when CELERY_BROKER_URL is missing
1 parent 77a974d commit 9c70d0a

File tree

1 file changed

+4
-4
lines changed
  • {{cookiecutter.project_slug}}/config/settings

1 file changed

+4
-4
lines changed

{{cookiecutter.project_slug}}/config/settings/base.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
# ------------------------------------------------------------------------------
4646
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
4747
try:
48-
{ % if cookiecutter.use_docker == "y" - %}
48+
{%- if cookiecutter.use_docker == "y" %}
4949
DATABASES = {"default": env.db("DATABASE_URL")}
50-
{ % - else %}
50+
{%- else %}
5151
DATABASES = {
5252
"default": env.db(
5353
"DATABASE_URL",
5454
default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.project_slug}}",
5555
),
5656
}
57-
{ % - endif %}
57+
{%- endif %}
5858
except environ.ImproperlyConfigured:
5959
DATABASES = {
6060
"default": {
@@ -297,7 +297,7 @@
297297
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-timezone
298298
CELERY_TIMEZONE = TIME_ZONE
299299
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-broker_url
300-
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
300+
CELERY_BROKER_URL = env("CELERY_BROKER_URL", default=env("REDIS_URL"))
301301
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std:setting-result_backend
302302
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
303303
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended

0 commit comments

Comments
 (0)