Search code examples
pythondjangovisual-studio-coderemote-debugging

Vs code remote container not stopping on breakpoints


I have a setup with both a devcontainer.json and a launch.json with the new Remote Container plugin in vs-code. But I cant get the breakpoints working. I get the app to launch and can browse it, but the breakpoints are not getting hit, am I missing something in my launch.json?

{
    // 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": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "runserver",
                "0.0.0.0:8000",
            ],
            "env": {
                "PYTHONUNBUFFERED": 1,
                "ENV": "local",
                "DJANGO_SITE_ID": 1,
                "DJANGO_SETTINGS_MODULE": "project.settings.local1",
            }
        }
    ]
}

Solution

  • Your configuration has diverged from the default launch.json config for Django and is missing some critical parts (it looks like everything that's missing is important):

        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "console": "integratedTerminal",
            "args": [
                "runserver",
                "--noreload",
                "--nothreading"
            ],
            "django": true
    },