简体   繁体   English

在调试Django应用程序时,如何告诉Visual Studio Code遵循Django本身的源代码?

[英]How to tell Visual Studio Code to follow Django itself source code while debugging Django applications?

I have a Django application and I set Visual Studio Code to debug it using the default launch.json configuration. 我有一个Django应用程序,并设置了Visual Studio Code以使用默认的launch.json配置对其进行调试。 When I start the server ( manage.py runserver ) and make a request, VSCode stops at the first breakpoint (that is correct), but when I step into a function, VSCode never follows/shows Django source code itself and I would like to see what is happening inside that Django source code. 当我启动服务器( manage.py runserver )并发出请求时,VSCode会在第一个断点处停止(这是正确的),但是当我进入一个函数时,VSCode永远不会遵循/显示Django源代码本身,我想看看Django源代码中发生了什么。

How could I configure VSCode to follow/show Django (and Django REST) source code while debugging Django applications? 在调试Django应用程序时,如何配置VSCode以遵循/显示Django(和Django REST)源代码?

EDIT 2019-05-07 : With VSCode 1.33.1, the option debugStdLib is obsoleted and it has been replaced by justMyCode , that is exactly the opposite. 编辑2019-05-07 :使用VSCode 1.33.1,选项debugStdLib已过时,并且已由justMyCode替换,这是完全相反的。 So to debug Django code, justMyCode has to be set to false in launch.json . 因此,要调试的Django代码, justMyCode必须被设置为falselaunch.json

Once you have debugging working, all you need to do is add the following setting into your launch.json file for the debug configuration used for Django : 调试工作完成后,您需要做的就是将以下设置添加到launch.json文件中,以用于Django的调试配置:

"debugStdLib": true,

This flag tells the Python debugger that you wish to debug standard library code. 该标志告诉Python调试器您希望调试标准库代码。

Eg: 例如:

        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "debugStdLib": true,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM