[Django]-Django-celery works in development, fails in wsgi production: How to debug?

2👍

After much searching, the most complete answer I found for this question is here. These directions flesh out the skimpy official directions for daemonizing celeryd. I’ll copy the gist here, but you should follow the link, because Michael has explained some parts in more detail.

The main idea is that you need scripts in three places:

  1. /etc/init.d/celeryd
  2. /etc/default/celeryd
  3. myApp/settings.py

Settings.py appears to be the same as in development mode. So if that’s already set up, there are four steps to shifting to production:

  1. Download the daemon script since it’s not included in the installation:
    https://github.com/celery/celery/tree/3.0/extra/generic-init.d/
  2. Put it in /etc/init.d/celeryd
  3. Make a file in /etc/default/celeryd, and put the variables here into it:
    http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#example-django-configuration
  4. Start the script

This solved my problem.

👤Abe

1👍

I think the reason you are not getting any response from celery, is because celeryd server might not be running. You could find out about it by doing ps -ef |grep celeryd. In order to figure out what is the error while trying to run celeryd, you might want to do the following.

In your settings.py file you could give the path to the celery log file CELERYD_LOG_FILE = <Path to the log file>
and while running celeryd server you could specify the level manage.py celeryd -l DEBUG.

Leave a comment