问题
I ma starting celery as
python manage.py celeryd
It is working but in foreground . Then to test commands i need to start another terminal and do stuff there.
is there any way to start that in background. I tried this
python manage.py celeryd &
But then again it comes at foreground
回答1:
You're looking for celeryd_detach
, available since at least 2.4
python manage.py celeryd_detach
回答2:
You can use this to get celeryd to work in the background
$ nohup celeryd start &
The above command pushes the celery daemon to the background.
回答3:
You can try "Supervisor". Install "django-supervisor" in your project, create a supervisor.conf in the same folder than your manage.py.
then, you just run:
python manager.py supervisor --daemonize
My supervisor.conf:
[program:celeryd]
command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd -l info
autostart=true
autorestart=true
stopwaitsecs = 600
[program:autoreload]
exclude=true
[program:runserver]
exclude=true
[program:celerybeat]
exclude=true
来源:https://stackoverflow.com/questions/6665893/how-to-start-celery-in-background-of-terminal-in-django