使用pycharm进行调试,如何进入项目,不需要输入django库 [英] Debugging with pycharm, how to step into project, without entering django libraries

查看:146
本文介绍了使用pycharm进行调试,如何进入项目,不需要输入django库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想想这种情况:

我调试我的Django项目,我逐步浏览代码(进出)。调试器有时会进入Django库或其他外部库。

I debug my Django project and I step through the code (in and out). The debugger sometimes enters Django libraries or other external libraries.

有谁知道如何防止调试器进入外部代码?或者至少有一个大的步骤让调试器回到项目代码?

Does anyone know how to prevent the debugger from entering external code? Or at least a 'big' step out to get the debugger back to the project code?

推荐答案


有没有人知道如何防止调试器进入外部代码?

Does anyone know how to prevent the debugger from entering external code?

是的,Dmitry Trofimov 知道;

Yes, Dmitry Trofimov knows;


(...)添加您不想追踪到dict的模块 DONT_TRACE < pycharm-distr> /helpers/pydev/pydevd.py

这是一个hacky解决方案(...) p>

(...) add modules you don't want to trace to the dict DONT_TRACE in <pycharm-distr>/helpers/pydev/pydevd.py
That is a hacky solution (...)

如果您希望此功能较少黑客,您可以通过访问问题对此进行投票

PY-9101实施不要进入课堂选项的Python调试器

If you want this feature to be less hacky you can vote on it by visiting issue
PY-9101 Implement "Do not step into the classes" option for Python debugger

使用pdb的人可能有兴趣知道pdb中有这样的功能;

Those using pdb might be interested to know there is such a feature in pdb;

开始与Python 3.1, Pdb 类有一个新的参数称为 skip -

Starting with Python 3.1, Pdb class has a new argument called skip -

class pdb.Pdb completekey ='tab',stdin = None,stdout = None,skip = None,nosigint = False)


如果给出,跳过参数必须是glob样式模块
名称模式的迭代。调试器不会进入与这些模式之一匹配的模块中的
的帧。 1

1 是否考虑框架来源于某个模块是
由框架全局变量中的 __ name __ 确定。

1 Whether a frame is considered to originate in a certain module is determined by the __name__ in the frame globals.

文档中给出的示例显示了如何跳过Django的包 -

The example given in the docs shows how to skip Django's packages -

import pdb; pdb.Pdb(skip = ['django。*'])。set_trace()

这篇关于使用pycharm进行调试,如何进入项目,不需要输入django库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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