I have a flask app, I am using celery as a task queue. I have a development version working well through a small script that looks like this:
from celery import Celery
from settings import REDIS_URL as redis_url
from tasks import *
celery = Celery('my_tasks',
broker = redis_url,
backend = redis_url )
if __name__ == "__main__":
celery.start()
which has worked well for development purposes, but now I’ve started looking into whether to improve this for deployment, and started reading about celeryd, etc.
The simplest question to start with if the above is just for testing & development and how to make the move to using celery in a production environment. I’m integrating several flask apps as well into a larger application, each with their own script similar to the above. How to refine celery for this isn’t quite clear at the moment and I’d be interested in input from others who have deployed celery with flask in a production environment.
I think you need a proper demonization of this script, there is nice documentation about this on the official doc website: http://celery.github.com/celery/cookbook/daemonizing.html
I really recommend you to have a look at Supervisor for this job (demonize a script like yours takes not more than 5 minutes).