README.rst 724 B

1234567891011121314151617181920212223242526272829
  1. This example is a simple Django HTTP service exposing a single task
  2. multiplying two numbers:
  3. The multiply http callback task is in ``views.py``, mapped to an url using
  4. ``urls.py``.
  5. There's no models, so to start it do::
  6. $ python manage.py runserver
  7. To execute the task you could use curl::
  8. $ curl http://localhost:8000/multiply?x=10&y=10
  9. which then gives the expected JSON response::
  10. {"status": "success": "retval": 100}
  11. To execute this http callback task asynchronously you could fire up
  12. a python shell with a properly configured celery and do:
  13. >>> from celery.task.http import URL
  14. >>> res = URL("http://localhost:8000/multiply").get_async(x=10, y=10)
  15. >>> res.wait()
  16. 100
  17. That's all!