Motivation
It is the second attempt to set up this configuration, and I forgot what I did in the previous approach. My notes what How I set up configuration.
Project
Project-based on Django. The project uses a Docker and a docker-compose. Pycharm uses a Python interpreter from docker-compose. We separate the project into two services:
- Celery
- API
Debugging
For API I use PyCharm Django debugger. Work fine and does not have any problems. But when I need to debug the Celery task. We have an issue with the classical debugger.
Pydevd-pycharm server good resolved the problem with it.
Setup
- Dockerfile. pip install pydevd-pycharm-
- Put to problem part of code:
import pydevd_pycharm
pydevd_pycharm.settrace('host.docker.internal', port=7777, stdoutToServer=True, stderrToServer=True)
Attention: host.docker.internal
hostname of host machine in a container.
Mapping folders between a host project and a container copy project.
Setup
Python Debug Server
in Pycharm. Where we find instruction how to setup pydevd-pycharm. Host: localhost Port: 7777
Top comments (0)