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

查看:59
本文介绍了如何使用 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

转到Edit Configuration,然后选择+"图标添加新的Python脚本并输入芹菜路径、其他参数和工作目录.您可以指定环境变量,并且您还可以选择要包含的父环境.另外,不要忘记选择你的 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天全站免登陆