[Answered ]-"No module named manage" error when trying to debug a Werkzeug Django app in VSCode

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
        }
    ]
}
👤ruddra

-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
        }
    ]
}
👤Ajay K

Leave a comment