Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use PyCharm to locally debug a Celery worker? [duplicate]

I have an existing Django project with a virtualenv. After activating the venv, I can run Celery just with the command celery. This works on Windows, OS X and Linux.

I wanted to try PyCharm on Windows, and I'm able to get it to run my Django server (using the project's venv), but I also want to run Celery, so I can debug that as well.

I can't find a simple, straightforward guide to setting up PyCharm so I can debug Celery (in a manner will work with PyCharm on any platform).

like image 371
Shaggy Frog Avatar asked May 11 '16 00:05

Shaggy Frog


People also ask

How do you Debug celery in PyCharm?

Go to Edit Configuration , then select the '+' icon to add new Python script and enter the celery path, other parameters and working directory. You can specify environment variables and bottom of that you have the option to select parent environment to include as well.

How do I run celery in debug mode?

First, I open my project in Eclipse and put a breakpoint at the beginning of the task function. Then, I'm starting the Celery workers from Eclipse by Right Clicking on manage.py from the PyDev Package Explorer and choosing "Debug As->Python Run" and specifying "celeryd -l info" as the argument.

Can you Debug in PyCharm?

In PyCharm debugger, you can preview int variables in the hexadecimal or binary format. This might be particularly helpful when you debug network scripts that include binary protocols.

How do I Debug a script in PyCharm?

Start debuggingOpen the HTML file that references the JavaScript to debug or select the HTML file in the Project tool window. From the context menu of the editor or the selection, choose Debug <HTML_file_name>. PyCharm generates a debug configuration and starts a debugging session through it.


1 Answers

This is what I do to run celery

Go to Edit Configuration, then select the '+' icon to add new Python script and enter the celery path, other parameters and working directory. You can specify environment variables and bottom of that you have the option to select parent environment to include as well. Also, don't forget to choose your python interpreter for taking care of virtual environment.

running celery using pycharm

like image 100
Hrishabh Gupta Avatar answered Sep 17 '22 14:09

Hrishabh Gupta