As the title says. I have a Django 4.1 app, which uses Werkzeug to enable https. I have the following launch.json set up:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"python": "${workspaceFolder}/venv/Scripts/python.exe",
"program": "${workspaceFolder}\appname\manage.py",
"args": [
"runserver_plus",
"--cert-file",
"${workspaceFolder}/certs/cert.pem",
"--key-file",
"${workspaceFolder}/certs/key.pem"
],
"justMyCode": false,
"django": true
}
]
}
When I run this through the VSCode debugger it immediately quits in the get_wsgi_application()
function with "No module named manage". I tried googling around, but no answer proved to be useful. Any ideas what I am doing wrong?
2
Answers
try this
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 thelaunch.json
configuration, which will add environment variable. In there you need to update thePYTHONPATH
, because manage.py is not in the root folder of the project: