Advertisement
fduran

Django Celery

Apr 10th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 KB | None | 0 0
  1. # www.fduran.com
  2. # set up Celery with Django (dev queuing)
  3.  
  4. (source activate)
  5.  
  6. # install (kombu is included)
  7. pip install celery
  8. pip install django-celery
  9.  
  10.  
  11. # edit settings.py :
  12.  
  13. INSTALLED_APPS = (
  14.     'djcelery',
  15.     'kombu.transport.django',
  16.     )
  17.  
  18.  
  19. import djcelery
  20. djcelery.setup_loader()
  21. BROKER_URL = 'django://'
  22.  
  23.  
  24. # run celery
  25. sudo -uwww-data /path/to/venv/bin/python ./manage.py celery worker --loglevel=info >> /var/log/celery.log 2>&1 &
  26.  
  27. # set celery up with supervisord
  28. cd /path_to/django/project
  29. # source ../virtualenv/bin/activate
  30. pip install supervisor
  31.  
  32. echo_supervisord_conf > supervisord.conf
  33.  
  34. supervisord.conf file:
  35.  
  36. ---
  37. [supervisord]
  38. logfile=/var/log/supervisord/supervisord.log
  39.  
  40. [program:celeryd]
  41. command=/home/ubuntu/django/virtualenv/bin/python /home/ubuntu/django/boomerang/manage.py celery worker --loglevel=info --
  42. user=www-data
  43. config=settings.py
  44. stdout_logfile=/var/log/celery.log
  45. stderr_logfile=/var/log/celery.log
  46. autostart=true
  47. autorestart=true
  48. startsecs=10
  49. stopwaitsecs=600
  50. umask=002
  51.  
  52. ---
  53. # mkdir /var/log/supervisord
  54. # touch /var/log/supervisord/supervisord.log
  55.  
  56.  
  57. # supervisord -c /etc/supervisord.conf
  58.  
  59. # supervisorctl tail celeryd
  60. # supervisorctl restart celeryd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement