Krzysztof Lipiński
Krzysztof Lipiński

Reputation: 11

Django Celery Redis Auth

I'm trying to add Celery to django to schedule tasks. I use Redis backend, and connect via unix socket. Setup was working until I have tried using password auth to redis.conf:

My settings.py:

CELERY_BROKER_URL = 'redis+socket:///home/username/domain/redis.sock?password=mypasswd'
CELERY_RESULT_BACKEND = 'redis+socket:///home/username/domain/redis.sock?password=mypasswd'

celery.py:

from __future__ import absolute_import, unicode_literals

import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'public_python.settings')
# celery settings for the demo_project
app = Celery('public_python')
app.config_from_object('django.conf:settings', namespace='CELERY')

app.autodiscover_tasks()

Result:

[2021-07-19 21:22:14,003: ERROR/MainProcess] consumer: Cannot connect to redis+socket:///home/username/domain/redis.sock: Authentication required..

I have already tried adding: CELERY_REDIS_PASSWORD='mypasswd' (any any concievable combination of similar words), with no luck.

Upvotes: 1

Views: 1891

Answers (1)

2ps
2ps

Reputation: 15966

The normal format using a network based socket would look like this:

redis://:[email protected]:6379/0

For file based socket, you might want to try:

redis+socket://:mypasswd@/home/username/domain/redis.sock?virtual_host=0

Upvotes: 5

Related Questions