PTVS
PTVS copied to clipboard
VSC debugger crashes when trying to attach to process running in docker container
Im trying to debug my Django process from vs code. But I am not able to get it to work. In my manage.py:
import ptvsd
try:
ptvsd.enable_attach("my_secret", address=('localhost', 3000))
except:
pass
In my docker-compose:
version: '3'
services:
db:
image: postgres
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
- "3000:3000"
depends_on:
- db
And my debug info in launch.json:
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/code",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
When starting the debug session I get a message saying: "debug adapter process has terminated unexpectedly". Does anyone have any tips on how to get this working? Im running ptvsd 3.0.0 both on my computer and in the docker container.
This sounds VSC specific. Please file it at https://github.com/Microsoft/vscode-python/issues. Thanks!