2👍
✅
This problem is only specific to VS Code’s debugger and it is happening for wrong path in PYTHONPATH
variable. Hence, this problem will not happen if you run it from shell.
In your case, you need to add a new attribute named env
in the launch.json
configuration, which will add environment variable. In there you need to update the PYTHONPATH
, because manage.py is not in the root folder of the project:
"configurations": [
{"env": {
"PYTHONPATH": "${workspaceRoot}\\appname"
},
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}\\appname\\manage.py",
"args": [
"runserver_plus"
],
"django": true,
"justMyCode": false
}
]
}
-1👍
try this
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"python": "${workspaceFolder}/venv/Scripts/python.exe",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
],
"justMyCode": false,
"django": true
}
]
}
- [Answered ]-Multiple File Upload Code for Django
- [Answered ]-Is there a way to rewrite this apparently simple Django snippet so that it doesn't hit the database so much?
- [Answered ]-Django Templates Variable Resolution
- [Answered ]-Django model A can has only one instance of model B
- [Answered ]-How to lazily evaluate ORM call after fixtures are loaded into db in Django?
Source:stackexchange.com