How can I use PyCharm to locally debug a Celery worker?(如何使用 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 PyCharm 在本地调试 Celery worker?
基础教程推荐
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
