/django-celery-example

1⃣ :snake: :three: Example of using the django-celery module.

Primary LanguagePython

Django-Celery Example

django admin with django-celery tasks dashboard

⚠ Warning this was done in Dajngo 1.7 *


Get Django-Celery Working!

  1. Install Python (if you're in linux, python 2.7 is already installed), pip, django (and run ./manage.py syncdb), celery, and django-celery
  2. Choose your celery broker and install that: RabbitMQ, Redis, others...
  3. Setup django-celery part 1: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#using-the-django-orm-cache-as-a-result-backend
  4. Setup django-celery part 2: https://github.com/celery/django-celery/blob/master/README.rst#using-django-celery
  5. Start all the things (processes):
  6. Start your redis-server or rabbitmq-server, ect...
  7. Start Django: ./manage.py runserver (and ./manage.py runserver $IP:$PORT in Cloud 9)
  8. Start the Celery Event Camera via: ./manage.py celery events --camera=djcelery.snapshot.Camera
  9. Start celeryd with celery beat (-B): ./manage.py celeryd -B -l INFO
  10. Run a task:
  11. ./manage.py shell
  12. from demoapp.tasks import add
  13. add.delay(2,2)
  14. and you should then see things happening in the Celery Beat process and in the Django Admin

Lots of steps involved and that's why I put together this project to provide an isolated example of using django-celery that worked for me in 2015 on Django 1.7 The less steps it takes, the more likely you are to get it running sooner. Cheers!