docker-django-example icon indicating copy to clipboard operation
docker-django-example copied to clipboard

IPDB debugging

Open mellonbrook opened this issue 3 years ago • 4 comments

I have put a PDB in my code to debug and am using docker attach to connect to the web container. I hit the breakpoint but cant step through the code...

mellonbrook avatar Jan 25 '23 16:01 mellonbrook

Ignore this. I needed to add:

stdin_open: true tty: true

to docker-compose.yaml for the web container.

mellonbrook avatar Jan 25 '23 16:01 mellonbrook

Thanks. tty: true is already set here btw: https://github.com/nickjj/docker-django-example/blob/a8d071082217a7a0a41de2b687ce04dcf553cd0f/docker-compose.yml#L17

Are there any implications of leaving stdin_open: true set all the time? Which command did you run to attach to the container? Was it literally the docker attach command or did you exec into it?

nickjj avatar Jan 25 '23 16:01 nickjj

I ran docker attach hellodjango-web-1. I also needed to increase the timeout of gunicorn.

mellonbrook avatar Jan 25 '23 16:01 mellonbrook

Thanks, that's useful to know. Maybe that timeout can be set as an env var to make it easier to switch in dev vs prod.

nickjj avatar Jan 25 '23 17:01 nickjj