如何使用PyCharm在本地调试Celery Worker? [英] How can I use PyCharm to locally debug a Celery worker?

查看:908
本文介绍了如何使用PyCharm在本地调试Celery Worker?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有virtualenv的现有Django项目。激活venv之后,我只需使用命令 celery 即可运行Celery。这适用于Windows,OS X和Linux。

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.

我想在Windows上尝试PyCharm,并且能够使用它运行Django服务器(使用项目的venv),但我也想运行Celery,因此也可以对其进行调试。

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.

我找不到设置PyCharm的简单直接的指南,所以我可以调试Celery(以某种方式可以在任何平台上与PyCharm一起使用)。

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).

推荐答案

这是我运行celery的工作

This is what I do to run celery

转到编辑配置,然后选择 +图标以添加新的Python脚本并输入celery路径,其他参数和工作目录。您可以指定环境变量,并在其底部可以选择要包括的父环境。另外,别忘了选择用于维护虚拟环境的python解释器。

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.

这篇关于如何使用PyCharm在本地调试Celery Worker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆