Django operates inside reques-response cycle, and it starts by request. So it is bad idea to attach such command to Django startup.
Instead of that, I would recommend you to look at supervisord - a process manager, that can automate services launch at system start and other things.
How do I start redis queue worker on django start?
Question
I decided I need to use an asynchronous queue system. And am setting up Redis/RQ/django-rq. I am wondering how I can start workers in my project.
django-rq provides a management command which is great, it looks like:
python manage.py rqworker high default low
But is it possible to start the worker when you start the django instance? Just wondering or is it something I will always have to start manually?
Thanks.
Solution
OTHER TIPS
When I host Django project in Heroku. Heroku provide a Procfile, you can specify what to start with project. It is my Procfile:
web: gunicorn RestApi.wsgi
worker: python manage.py rqworker default
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow