Redis не работает. __init__() получил неожиданный аргумент ключевого слова 'username'

Я пытаюсь запустить celery -A project worker -l info. Но каждый раз возвращается ошибка типа init got unexpected error. Пожалуйста, помогите. Заранее спасибо.

мой файл настроек:

CELERY_BROKER_URL = 'redis://localhost:6379'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Africa/Nairobi'

файлcelery:

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

# setting the Django settings module.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
app = Celery('project')
app.config_from_object('django.conf:settings', namespace='CELERY')

# Looks up for task modules in Django applications and loads them
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task():
    print('Request')

init file

from __future__ import absolute_import

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app

Я только что решил проблему, установив связку Redis.

pip install "celery[redis]"

Ваша проблема, скорее всего, связана с регрессией в Kombu при подключении к redis. Путь вперед - либо следовать инструкциям здесь: https://github.com/celery/kombu/issues/1419 или перевести Kombu на более низкую версию. (Я установил Kombu на 5.0.2)

Вернуться на верх