- Go to user settings (cmd-,):
"python.venvPath": "~/.virtualenvs",
- Quit VSCode.
- Open a Python file in VSCode.
- Select virtualenv in bottom bar.
- Debug > Open Configurations to create launch.json. Otherwise, "Add Configurations" may not work.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Server",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Script",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runscript",
"$(basename -s .py ${file})"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
}
]
}
- Click button on bottom right to Install Linting.
0 comments:
Post a Comment