title: Read Celery configuration from Python properties file
body: <p>I have an application that needs to initialize Celery and other things (e.g. database).  I would like to have a .ini file that would contain the applications configuration.  This should be passed to the application at runtime.</p>
  
  <p>development.init:</p>
  
  <pre><code>[celery]
  broker=amqp://localhost/
  backend=amqp://localhost/
  task.result.expires=3600
  
  [database]
  # database config
  # ...
  </code></pre>
  
  <p>celeryconfig.py:</p>
  
  <pre><code>from celery import Celery
  import ConfigParser
  
  config = ConfigParser.RawConfigParser()
  config.read(...) # Pass this from the command line somehow
  
  celery = Celery('myproject.celery',
                  broker=config.get('celery', 'broker'),
                  backend=config.get('celery', 'backend'),
                  include=['myproject.tasks'])
  
  # Optional configuration, see the application user guide.
  celery.conf.update(
      CELERY_TASK_RESULT_EXPIRES=config.getint('celery', 'task.result.expires')
  )
  
  # Initialize database, etc.
  
  if __name__ == '__main__':
      celery.start()
  </code></pre>
  
  <p>To start Celery, I call:</p>
  
  <pre><code>celery worker --app=myproject.celeryconfig -l info
  </code></pre>
  
  <p>Is there anyway to pass in the config file without doing something ugly like setting a environment variable?</p>