nickjj / docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
MIT License
1.17k stars 249 forks source link

IPDB debugging #34

Closed mellonbrook closed 1 year ago

mellonbrook commented 1 year ago

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 commented 1 year ago

Ignore this. I needed to add:

stdin_open: true tty: true

to docker-compose.yaml for the web container.

nickjj commented 1 year ago

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?

mellonbrook commented 1 year ago

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

nickjj commented 1 year ago

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.