mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 22:59:39 +00:00
parse unix connection string for redis socket
This commit is contained in:
@@ -5,12 +5,21 @@ import os
|
|||||||
from celery import Celery
|
from celery import Celery
|
||||||
from common.src.env_settings import EnvironmentSettings
|
from common.src.env_settings import EnvironmentSettings
|
||||||
|
|
||||||
|
|
||||||
|
def con_parser():
|
||||||
|
"""allow for unix socket parsing"""
|
||||||
|
redis_con = EnvironmentSettings.REDIS_CON
|
||||||
|
if redis_con.startswith("unix://"):
|
||||||
|
redis_con = EnvironmentSettings.REDIS_CON.replace(
|
||||||
|
"unix://", "redis+socket://", 1
|
||||||
|
)
|
||||||
|
|
||||||
|
return redis_con
|
||||||
|
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||||
app = Celery(
|
app = Celery(
|
||||||
"tasks",
|
"tasks", broker=con_parser(), backend=con_parser(), result_extended=True
|
||||||
broker=EnvironmentSettings.REDIS_CON,
|
|
||||||
backend=EnvironmentSettings.REDIS_CON,
|
|
||||||
result_extended=True,
|
|
||||||
)
|
)
|
||||||
app.config_from_object(
|
app.config_from_object(
|
||||||
"django.conf:settings", namespace=EnvironmentSettings.REDIS_NAME_SPACE
|
"django.conf:settings", namespace=EnvironmentSettings.REDIS_NAME_SPACE
|
||||||
|
|||||||
Reference in New Issue
Block a user