Refactor Celery settings to use dynamic Redis host configuration
This commit is contained in:
@@ -89,8 +89,9 @@ CIMAR_PASSWORD = "<REPLACE-WITH-SECRET>"
|
||||
|
||||
# Celery settings — when running in docker the redis service is
|
||||
# reachable at the `redis` hostname provided by docker compose.
|
||||
CELERY_BROKER_URL = "redis://redis:6379"
|
||||
CELERY_RESULT_BACKEND = "redis://redis:6379"
|
||||
REDIS_HOST = os.environ.get("REDIS_HOST", "redis")
|
||||
CELERY_BROKER_URL = f"redis://{REDIS_HOST}:6379"
|
||||
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:6379"
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
|
||||
@@ -56,5 +56,6 @@ CIMAR_PASSWORD = "<REPLACE-WITH-SECRET>"
|
||||
|
||||
# Celery settings — when running in docker the redis service is
|
||||
# reachable at the `redis` hostname provided by docker compose.
|
||||
CELERY_BROKER_URL = "redis://redis:6379"
|
||||
CELERY_RESULT_BACKEND = "redis://redis:6379"
|
||||
REDIS_HOST = os.environ.get("REDIS_HOST", "redis")
|
||||
CELERY_BROKER_URL = f"redis://{REDIS_HOST}:6379"
|
||||
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:6379"
|
||||
|
||||
+4
-3
@@ -381,8 +381,9 @@ CIMAR_USERNAME = ""
|
||||
CIMAR_PASSWORD = ""
|
||||
|
||||
# Celery settings
|
||||
CELERY_BROKER_URL = "redis://redis:6379"
|
||||
CELERY_RESULT_BACKEND = "redis://redis:6379"
|
||||
REDIS_HOST = os.environ.get("REDIS_HOST", "redis")
|
||||
CELERY_BROKER_URL = f"redis://{REDIS_HOST}:6379"
|
||||
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:6379"
|
||||
|
||||
# Django 6 task framework settings.
|
||||
# Use DJANGO_TASK_BACKEND to select your backend implementation.
|
||||
@@ -403,7 +404,7 @@ CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [("redis", 6379)],
|
||||
"hosts": [(REDIS_HOST, 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user