[Answered ]-Both Dockerize and be able to debug a Django app using vscode

1👍

Yes, this is possible.

I’ve done it with a NestJs app and should be a similar setup.

Expose a specific port on the Django app service in the compose file first.

Create the launch.json file the following configuration, then replace <port-exposed-on-container> and <directory-on-container> with real values.

{
    "version": "0.2.0",
    "configurations": 
    [
      {
        "name": "Docker: Attach to Node",
        "type": "node",
        "request": "attach",
        "port": <port-exposed-on-container>,
        "address": "localhost",
        "localRoot": "${workspaceFolder}",
        "remoteRoot": "/<directory-on-container>",
        "protocol": "inspector",
        "restart": true
      },
    ]
}

Leave a comment