I'm trying to switch my local Pycharm + Django to docker based dev env. I run on mac and use Docker-Compose (few dockers: my django app, some db and nginx).
All runs fine, code change immediately reflected in docker and correct packages available while coding in Pycharm. Once docker-compose started, a list of running containers is shown in Pycharm's docker plugin window, for each container i can see its log/properties/port/volume bindings.
Interpreter seems to be configured properly with Docker Compose(app at [{my path}/docker-compose.yaml]) as project interpreter and path mapping for ->/code to the correct folder in docker.
The problem is I don't manage to debug it. When i select Docker-Compose in debug dialog the only option available is Run, not Debug.
It doesn't look to me as Docker/Compose issue, but Pycharm plugin which doesn't let to run in debug with docker-compose run/debug configuration.
Any idea how to debug it with Pycharm?
You are supposed to use standard Python run configuration, no the Docker-specific one. The latter is used to build containers, start docker-compose services and so on.
PyCharm will auto-start your services, mount your code and execute it inside a container with pure Python Run Configuration if a Docker-based interpreter is selected.
Perhaps the docs can help: https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html
There is currently a problem running dockerized django with an entry point, so to give an idea of the problem if someone else lands here with that! if you are facing this problem create a different docker-compose.dev.yml file just for debugging without an entry point. This is the work around for now
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With