I need to debug celery
task to see whether it is working properly or not, So I put some print
statements inside tasks.py
. While running the project I have observed that task successfully runs but doesn't print anything on the console. How can I debug the celery task.
When Celery actually does the work, tasks are being handled by different Python processes. Depending on how you have things configured, those separate processes might have no access to your console. Instead, they will write to Celery's log file (which can be configured in various ways). Find that file, and you'll see print output from your tasks.
All of that assumes that you have indeed restarted the Celery workers, as suggested by the comment from Gaurav Tomer.