Home > Back-end >  Django Celery Redis
Django Celery Redis

Time:06-30

I have this error A rediss:// URL must have parameter ssl_cert_reqs and this must be set to CERT_REQUIRED, CERT_OPTIONAL, or CERT_NONE

settings

CELERY_BROKER_URL = os.environ.get('REDIS_URL', "redis://localhost:6379")
CELERY_RESULT_BACKEND = os.environ.get('REDIS_URL', "redis://localhost:6379")
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

celery.py

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

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproj.settings')

app = Celery(
'myproj',
broker_use_ssl = {
    'ssl_cert_reqs': ssl.CERT_NONE
})

app.config_from_object('django.conf:settings', namespace="CELERY")

app.autodiscover_tasks()

I changed the value of ssl_cert_reqs to different value 'none', 'cert_required', ..., but nothing, always the same error when I use rediss:// instead of redis://.

CodePudding user response:

i never used option broker_use_ssl, can you try delete this option and try again

app = Celery('myproj')

or update

 Celery('myproj',
     broker_use_ssl = {
        'ssl_cert_reqs': ssl.CERT_NONE
     },
     redis_backend_use_ssl = {
        'ssl_cert_reqs': ssl.CERT_NONE
     }
)
  • Related