Skip to content

Instantly share code, notes, and snippets.

@fduran
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fduran/11400989 to your computer and use it in GitHub Desktop.
Save fduran/11400989 to your computer and use it in GitHub Desktop.
# www.fduran.com
# set up Celery with Django (dev queuing)
(source activate)
# install (kombu is included)
pip install celery
pip install django-celery
# edit settings.py :
INSTALLED_APPS = (
'djcelery',
'kombu.transport.django',
)
import djcelery
djcelery.setup_loader()
BROKER_URL = 'django://'
# run celery
sudo -uwww-data /path/to/venv/bin/python ./manage.py celery worker --loglevel=info >> /var/log/celery.log 2>&1 &
# set celery up with supervisord
cd /path_to/django/project
# source ../virtualenv/bin/activate
pip install supervisor
echo_supervisord_conf > supervisord.conf
supervisord.conf file:
---
[supervisord]
logfile=/var/log/supervisord/supervisord.log
[program:celeryd]
command=/home/ubuntu/django/virtualenv/bin/python /home/ubuntu/django/boomerang/manage.py celery worker --loglevel=info --config=settings.py
user=www-data
stdout_logfile=/var/log/celery.log
stderr_logfile=/var/log/celery.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600
umask=002
---
# mkdir /var/log/supervisord
# touch /var/log/supervisord/supervisord.log
# supervisord -c /etc/supervisord.conf
# supervisorctl tail celeryd
# supervisorctl restart celeryd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment