title: celery + django - how to write task state to database
body: <p>I'm running Celery with Django and RabbitMQ and want to see the task states in the database table. Unfortunately no entries are written into the table djcelery_taskstate and I can't figure out why.</p>
  
  <p>My settings:</p>
  
  <pre><code>CELERY_ENABLE_UTC = True
  BROKER_URL = "amqp://guest:guest@localhost:5672/"
  CELERY_RESULT_BACKEND = "database"
  CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
  
  CELERY_TRACK_STARTED = True
  CELERY_SEND_EVENTS = True
  
  CELERY_IMPORTS = ("project_management.tasks", "accounting.tasks", "time_tracking.tasks", )
  CELERY_ALWAYS_EAGER = False
  
  import djcelery
  djcelery.setup_loader()
  </code></pre>
  
  <p>My Task:</p>
  
  <pre><code>class TestTask(Task):
  
      def run(self, po_id):
          self.update_state(state=states.STARTED, meta={'total': 0, 'done': False})
          #do something..
          self.update_state(state=states.SUCCESS, meta={'total': 100, 'done': True})
  </code></pre>
  
  <p>I'm starting the task as follows in a view:</p>
  
  <pre><code>TestTask.apply_async(args=[], kwargs={})
  </code></pre>
  
  <p>I'm starting celery workers as follows. </p>
  
  <pre><code>python manage.py celeryd -v 1 -B -s celery -E -l INFO
  </code></pre>
  
  <p>Console gives me the following output:</p>
  
  <pre><code>[2013-05-19 11:10:03,774: INFO/MainProcess] Task accounting.tasks.TestTask[5463b2ed-0eba-451d-b828-7a89fcd36348] succeeded in 0.0538640022278s: None
  </code></pre>
  
  <p>Any idea what is wrong with my setup?</p>