Debugging Django Applications in VSCode

This is very handy if our program fails to achieve the desired result and we want to run it line by line to see what went wrong. So, click on this button and open the "run and debug" panel.

hohoooo.png When we see the panel, we should create a launch.json file. Basically, we need to create a launch profile so, vscode knows how to run or debug this application.

pip file.png

Select Django and click;

hello ilke.png Here, we have a bunch of key value pairs. And, they define a launch profile. We can add "9000" to the arguments to not let it confuse with 8000 port.

 "args": [
                "runserver",
                "9000"
            ],

This file should be uploaded to our project inside .vscode folder. Now, when we go to "Run and Debug" panel we can see "Run Django" option like this as well:

debug.png