title: Celeryd can't seem to find my Django project’s settings
body: <p>I'm a celery noob at the moment, but trying to get started.  I'm running Django 1.4 + django-celery + celery 3.0.21 with a redis storage backend.  I can get a worker and celerybeat to run 'manually' via:</p>
  
  <p><code>python manage.py celery worker -E -B --loglevel=INFO -n w1.manual</code></p>
  
  <p>I want to move this into init-scripts.  So, I've installed the two init scripts supplied by celery.  I can run them as desired and <em>the scripts</em> work fine.  However, the worker started by the script is failing. It doesn't appear to be finding my project's settings.  Here's the contents of my configuration file at /etc/default/celeryd:</p>
  
  <pre><code># Name of nodes to start
  # here we have a single node
  CELERYD_NODES="w1"
  
  # or we could have three nodes:
  #CELERYD_NODES="w1 w2 w3"
  
  # Where to chdir at start.
  CELERYD_CHDIR="/var/www/www_project_com/"
  
  # Extra arguments to celeryd
  CELERYD_OPTS="--time-limit=300 --concurrency=8"
  
  # Name of the celery config module.
  CELERY_CONFIG_MODULE="celeryconfig"
  
  # %n will be replaced with the nodename.
  CELERYD_LOG_FILE="/var/log/celery/%n.log"
  CELERYD_PID_FILE="/var/run/celery/%n.pid"
  
  # Workers should run as an unprivileged user.
  CELERYD_USER="www-data"
  CELERYD_GROUP="www-data"
  
  # Name of the projects settings module
  export DJANGO_SETTINGS_MODULE="settings"
  </code></pre>
  
  <p>my settings files is actually divided into local/production/etc. and the production settings are located here:</p>
  
  <pre><code>/var/www/www_project_com/project/settings/production.py
  </code></pre>
  
  <p>I've attempted to change the last line of the config file to be:</p>
  
  <pre><code>export DJANGO_SETTINGS_MODULE="project.settings.production"
  </code></pre>
  
  <p>But it seemed to make no difference.</p>
  
  <p>I know that the init scripts are picking up the settings file /etc/default/celery because the process <em>is</em> using my custom-defined user and group.</p>
  
  <p>It is clear that the processes are failing because the logs show:</p>
  
  <pre><code>consumer: Cannot connect to amqp://guest@127.0.0.1:5672//: [Errno 111] Connection refused.
  </code></pre>
  
  <p>Which I presume is a default setting.  My Django project is configured to use Redis using the connection string:</p>
  
  <pre><code>BROKER_URL = 'redis://localhost:6379/0'
  </code></pre>
  
  <p>As another attempt to sort this out, I've tried setting the last line to:</p>
  
  <pre><code>export DJANGO_SETTINGS_MODULE="settings.production"
  </code></pre>
  
  <p>This results in:</p>
  
  <pre><code>[2013-07-19 05:31:48,117: ERROR/MainProcess] Unrecoverable error: ImportError('No module named settings',)
  </code></pre>
  
  <p>In the logs.</p>
  
  <p>What am I doing wrong?</p>