- [Show page]
- [Old revisions]
- [[unknown link type]]
- []
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
python:celery [2015/06/22 14:41] vondra [Django Integration] |
python:celery [2015/06/22 16:13] (current) vondra [Instalation] |
||
---|---|---|---|
Line 14: | Line 14: | ||
(note: make sure there is not south installed on your system when using django >= 1.7) | (note: make sure there is not south installed on your system when using django >= 1.7) | ||
+ | if unable to start RabbitMQ and <code> ERROR: epmd error for host address (cannot connect to host/port)</code> | ||
+ | in /var/log/rabbitmq/startup_log, put your hostname in /etc/hosts after localhost | ||
===== Django Integration ===== | ===== Django Integration ===== | ||
http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html | http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html | ||
- Create project celery config projectname/celery.py: <code python> | - Create project celery config projectname/celery.py: <code python> | ||
- | ffrom __future__ import absolute_import | + | from __future__ import absolute_import |
import os | import os | ||
Line 73: | Line 75: | ||
multiples.append(j) | multiples.append(j) | ||
return results | return results | ||
+ | </code> | ||
+ | - Sync django db (./manage.py syncdb or ./manage.py makemigrations && migrate) | ||
+ | - Add djcelery to INSTALLED_APPS and add following lines to project/settings.py:<code python> | ||
+ | CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler' | ||
+ | CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend' | ||
+ | </code> | ||
+ | - Run celery watcher: <code bash>./manage.py celeryd -E</code> | ||
+ | - Optionaly: run celerycam and celerymon to enable the monitoring via DB:<code bash> | ||
+ | ./manage.py celerycam | ||
+ | ./manage.py celerymon | ||
</code> | </code> |
python/celery.1434976861.txt.gz · Last modified: 2015/06/22 14:41 by vondra