I'm new at django development and come from desktop/mobile app development with Xcode and related IDE.
I have to use Django and I was wondering if there was an efficient way to debug it using Visual Studio Code (or Atom).
Any help related to Django IDE would be helpful too.
Start by clicking on the debug icon on the left-hand panel of your VSCode. Click on create a launch. json file, which will give you a drop-down of all your currently installed debuggers. By default, a Python debugger is not installed in VSCode.
To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.
The best thing about VScode is that it comes with a built-in terminal which comes handy for Django projects press Ctrl+Shift+` to invoke the terminal. Note that in windows powershell may seem weird for new users it is recommended to use Python debug console or CMD.
For VSCode (full disclosure, I'm one of the VSCode developers) try installing the Python extension to get started.
This documentation covers debugging Django. There should be a included debug configuration or you can add your own to the launch.json
file:
{ "name": "Django", "type": "python", "request": "launch", "stopOnEntry": false, "pythonPath": "${config.python.pythonPath}", "program": "${workspaceRoot}/manage.py", "args": [ "runserver", "--no-color", "--noreload" ], "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput", "DjangoDebugging" ] }
The Python extension also provide many other features that you may find useful.
Hope that helps you get started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With