# First steps with celery-pylons

## Configuring your Pylons project to use Celery

There are a few simple steps to integrate Celery into your Pylons project.

1. Install celery-pylons (see :ref:installation)

2. Add the following [2] to your development.ini file in the section [app:main] [1]:

broker.host = localhost
broker.port = 5672
broker.vhost = [vhost]
celery.result.backend = amqp
celery.result.dburi = amqp://
celery.imports = [list of classes: app.tasks.module]

3. That's it! Give it a try [3]:

$paster celeryd development.ini  Please Note:  [1] Application label may vary depending on Pylons setup.  [2] Working on the assumption you've set up user, vhost, etc using rabbitmqctl  [3] Depending on your Pylons setup, you may need to append #_your_app_name_ to the development.ini paster config file argument: $ paster celeryd development.ini#foo 

## Running the celery worker server

Assuming you've got your virtualenv activated:

$paster celeryd -B  However, in production you'll probably want to run the work in the background as a daemon. You'll need to rely on the tools provided by your platform. See the celery docs Running Celery as a Daemon. For a complete listing of the command line optinos available, use the help command: $ paster help


Please note: All the tasks have to be stored in a real module, they can't be defined in the python shell or ipython/bpython. This is because the celery worker server needs access to the task function to be able to run it.