2013-04-23 18 views
5

ho nella mia configurazione sedanosedano tenta di connettersi al broker sbagliato

BROKER_URL = 'redis://127.0.0.1:6379' 
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379' 

Eppure ogni volta che si esegue il celeryd, ottengo questo errore

consumer: Cannot connect to amqp://[email protected]:5672//: [Errno 111] Connection refused. Trying again in 2.00 seconds... 

Perché non è la connessione a Redis broker con cui l'ho installato, che è in esecuzione btw?

+1

Sembra sedano c annot trova la tua configurazione e usa default. Dove hai messo il tuo file 'celeryconfig.py'? Deve essere sul tuo percorso Python ([docs] (http://docs.celeryproject.org/en/latest/configuration.html#configuration-and-defaults)). – alecxe

risposta

4

importare il tuo sedano e aggiungere il vostro broker di simile:

celery = Celery('task', broker='redis://127.0.0.1:6379') 
celery.config_from_object(celeryconfig) 
+0

Dove andrebbe? Ho un file celery.py che contiene codice simile alla tua risposta, che si trova nella stessa cartella del mio settings.py. Eppure ho lo stesso errore di OP. Stesso problema quando inserito in settings.py –

+0

Ho lo stesso problema. Si prega di consultare il mio post su http://stackoverflow.com/questions/29402447/how-to-set-celeryconfig-file-in-in-django?noredirect=1#comment47060151_29402447 – user61629

+0

Per quanto ne so, 'config_from_object' sovrascriverà' broker' dato come argomento al costruttore, se 'BROKER_URL' esiste all'interno del file celeryconfig ... – chefarov

0

Se avete seguito First Steps with Celery tutorial, in particolare:

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

allora avete bisogno di prefisso le impostazioni con CELERY, in modo da cambiare la vostra BROKER_URL a:

CELERY_BROKER_URL = 'redis://127.0.0.1:6379' 
Problemi correlati