I\'m trying to find some instructions on how to enable PyCharm debugging within my celery processes on a remote machine. The remote machine is running Ubuntu 14.04.
For Windows, tested in with Celery >= 4.0
Add a new (Run/Debug) configuration of type "Python":
Then, Under configuration tab: switch the first option (Target to run) from "Script path" to "Module name" and fill in the value:
celery.bin.celery
like the snapshot below:
Unfortunately, most solutions don't work on Windows. (There was a separate question specifically about that, but unfortunately it got closed as a duplicate of this one. So I'll answer that question here now.)
The problem is that on Windows, the standalone celery command is a batch file, so PyCharm cannot attach the Python debugger to it.
Up until Celery 3.x, you can create a manage.py
run configuration and call the celery worker
command on it.
Note that you don't need to set --app
here, as the application is defined by the management command via DJANGO_SETTINGS_MODULE
.
Unfortunately, the celery
management command was a feature of the django-celery
library, which isn't supported by Celery 4.x. As of yet, I haven't found a solution for Celery 4.x.