views:

47

answers:

2

Hi, I have a pylons based webapp and i'd love to use celery + rabbitmq for some time taking tasks. I've taken a look at the celery-pylons project but I haven't succeeded in using it.

My main problem with celery is: where do i put the celeryconfig.py file or is there any other way to specify the celery options eg. BROKER_HOST and the like, from within a pylons app (In the same way one can put the options in the django settings.py file when using django-celery).

Basically, i investigated 2 options: using celery as a standalone project and using celery-pylons, both without much success.. :(

Thanks in advance for your help.

+2  A: 

I am doing this currently, although I've not updated celery in some time. I'm still on 2.0.0 I think.

What I did was to create a celery_app directory within my pylons application. (so in same directory as data, controllers, etc.)

In that directory are my celeryconfig.py, tasks.py, and pylons_tasks.py.

pylons_tasks.py is just a file that initializes the pylons application so I can load Pylons models and such into the celery tasks.py file. So it does the pylons init and then imports tasks.py.

The celeryconfig is then set to use myapp.celery_app.pylons_tasks as the CELERY_IMPORTS value.

CELERY_IMPORTS = ("myapp.celery_app.pylons_tasks", )

Hope that helps some.

Rick
A: 

Thanks, i'll try that out.

371c