Search code examples
pythondjangopostgresqlherokucelery

How do I get Celery to execute in production on Heroku?


I'm using Celery on my Django app.

I can't get the celery task to execute unless I run celery -A appname worker -l info --pool=solo in the terminal.

How do I get it execute when the site is in production?


Solution

  • You need to add a worker process to your Procfile, e.g.

    web: gunicorn some_app.wsgi
    worker: celery -A appname worker -l info --pool solo
    

    After redeploying, scale up one or more workers, e.g. by running

    heroku ps:scale worker=1