[Django]-Running supervisord from the host, celery from a virtualenv (Django app)

6👍

Path to celery binary is myenv/bin/celery whereas you are using myenv/local/lib/python2.7/site-packages/celery/bin/cel‌‌​​ery.

So if you try on your terminal the command you are passing to supervisor (command=xxx), you should get the same error.

You need to replace your command=xxx in your celery.conf with

command=/home/mhb11/.virtualenvs/myenv/bin/celery -A myproject.celery -l info

Note that I have also replaced -A parameter with celery app, instead of supervisor configuration. This celery app is relevant to your project directory set in celery.conf with

directory = /home/mhb11/somefolder/myproject

On a side note, if you are using Celery with Django, you can manage celery with Django’s manage.py, no need to invoke celery directly. Like

python manage.py celery worker
python manage.py celery beat

For detail please read intro of Django Celery here.

Leave a comment