django-celery

django-celery provides Celery integration for Django; Using the Django ORM and cache backend for storing results, autodiscovery of task modules for applications listed in INSTALLED_APPS, and more.

Using django-celery

To enable django-celery for your project you need to add djcelery to INSTALLED_APPS:
INSTALLED_APPS += ("djcelery", )
then add the following lines to your settings.py:
import djcelery
djcelery.setup_loader()
Everything works the same as described in the Celery User Manual, except you need to invoke the programs through manage.py:
Program Replace with
celery python manage.py celery
celery worker python manage.py celery worker
celery beat python manage.py celery beat
celery ... python manage.py celery ...
The other main difference is that configuration values are stored in your Django projects’ settings.py module rather than in celeryconfig.py.
If you’re trying celery for the first time you should start by reading Getting started with django-celery

Special note for mod_wsgi users

If you’re using mod_wsgi to deploy your Django application you need to include the following in your .wsgi module:
import djcelery
djcelery.setup_loader()

Documentation

The Celery User Manual contains user guides, tutorials and an API reference. Also the django-celery documentation, contains information about the Django integration.

Installation

You can install django-celery either via the Python Package Index (PyPI) or from source.
To install using pip,:
$ pip install django-celery
To install using easy_install,:
$ easy_install django-celery
You will then want to create the necessary tables. If you are using south for schema migrations, you’ll want to:
$ python manage.py migrate djcelery
For those who are not using south, a normal syncdb will work:
$ python manage.py syncdb

Downloading and installing from source

Download the latest version of django-celery from http://pypi.python.org/pypi/django-celery/
You can install it by doing the following,:
$ tar xvfz django-celery-0.0.0.tar.gz
$ cd django-celery-0.0.0
# python setup.py install # as root

Using the development version

You can clone the git repository by doing the following:
$ git clone git://github.com/celery/django-celery.git

No comments:

Post a Comment