Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I just went through this so I can shed some light on this. One might think for all of the great documentation stating some of this would have been a bit more obvious.</p> <p>I'll assume you have both RabbitMQ up and functioning (it needs to be running), and that you have <a href="https://github.com/ask/django-celery" rel="nofollow noreferrer">dj-celery</a> installed.</p> <p>Once you have that then all you need to do is to include this single line in your setting.py file.</p> <pre><code>BROKER_URL = "amqp://guest:guest@localhost:5672//" </code></pre> <p>Then you need to run syncdb and start this thing up using:</p> <pre><code>python manage.py celeryd -E -B --loglevel=info </code></pre> <p>The <code>-E</code> states that you want events captured and the <code>-B</code> states you want celerybeats running. The former enable you to actually see something in the admin window and the later allows you to schedule. Finally you need to ensure that you are actually going to capture the events and the status. So in another terminal run this:</p> <pre><code>./manage.py celerycam </code></pre> <p>And then finally your able to see the working example provided in the docs.. -- Again assuming you created the tasks.py that is says to.</p> <pre><code>&gt;&gt;&gt; result = add.delay(4, 4) &gt;&gt;&gt; result.ready() # returns True if the task has finished processing. False &gt;&gt;&gt; result.result # task is not ready, so no return value yet. None &gt;&gt;&gt; result.get() # Waits until the task is done and returns the retval. 8 &gt;&gt;&gt; result.result # direct access to result, doesn't re-raise errors. 8 &gt;&gt;&gt; result.successful() # returns True if the task didn't end in failure. True </code></pre> <p>Furthermore then you are able to view your status in the admin panel. </p> <p><img src="https://i.stack.imgur.com/711fd.jpg" alt="Django Task Manager"></p> <p>I hope this helps!! I would add one more thing which helped me. <em>Watching the RabbitMQ Log file was key as it helped me identify that django-celery was actually talking to RabbitMQ.</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload