Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Example project

A minimal Django project wired to Celery and django_taskpulse, with demo tasks that succeed (add), run slowly (slow_report), fail (always_fails) and retry twice before succeeding (flaky_fetch).

Without a broker (eager mode)

From this directory, with the package installed (pip install -e "..[dev]"):

python manage.py migrate
python manage.py createsuperuser
python manage.py demo_seed
python manage.py runserver

demo_seed runs every demo task inline and records ~10 task runs. Browse them at http://127.0.0.1:8000/admin/django_taskpulse/taskrun/ and open the Stats button for aggregates.

With a real worker

Point CELERY_BROKER_URL at a broker (defaults to redis://localhost:6379/0) and start a worker from this directory:

celery -A config worker -l info --pool=solo

Then queue tasks from python manage.py shell:

from demo.tasks import add, always_fails, flaky_fetch, slow_report
add.delay(2, 3)
always_fails.delay()
flaky_fetch.delay()
slow_report.delay(1.5)