Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure pycharm debug for docker-compose celery command?

I successfully configure my remote interpreter with docker-compose at Pycharm and can successfully run my server in debug mode to put breakpoints and debug the problems. Unfortunately I can't do the same thing for the docker-compose run for celery workers. When I run this command in my project folder it is working no problem but how can I run this in Pycharm debug mode ?

docker-compose run --rm app celery worker -A workers.build_events -Q build_events -l DEBUG

like image 557
ogul Avatar asked Apr 08 '26 03:04

ogul


1 Answers

I was just able to get this working with a Python run configuration.

Make sure the working directory is set to the directory that your application code is located at inside your image.

Make sure that the script path is the path to the Celery executable. In my case, I have a virtualenv inside my application folder, so I just used a relative path from my working directory.

Make sure that your interpreter is set to a properly configured docker compose interpreter.

Finally, I've added -P solo to force Celery into a single-threaded mode. This is not required, but for me it makes breakpoints and debugging much easier.

Example run configuration: Celery run configuration

like image 114
asdag8 Avatar answered Apr 10 '26 21:04

asdag8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!