Can t debug in PyCharm for Django inside Docker

0 votes

I want to use PyCharm's debugging tools and separate test launches while yet being able to put my full working environment within Docker containers. Remote Interpreter for PyCharm

I have the following configs:

Dockerfile:

FROM python:3.6

ENV PYTHONUNBUFFERED 0

COPY requirements.txt .
RUN pip install --no-cache-dir -r ./requirements.txt

docker-compose.dev.yml

version: '2'

services:

  web:
    container_name: django-first-ci-dev--web
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - ./:/django-ci
    working_dir: /django-ci
    env_file:
      - .envs
    links:
      - postgres:postgres
    depends_on:
      - postgres
    ports:
      - '8000:8000'

  postgres:
    container_name: django-first-ci-dev--postgres
    image: postgres:latest
    volumes:
      - ./docker-volumes-dev/psql-data:/var/lib/postgresql/data
    env_file:
      - .envs
    ports:
      - '5432:5432'

Everything functions perfectly on its own, changes are made instantly, and the environment is solitary. But using PyCharm for both debugging and running separate tests is not possible. I did as instructed in the documentation:enter image description here

Launch logs:

Removing django-first-ci-dev--web
django-first-ci-dev--postgres is up-to-date
Recreating 6eb846916022_django-first-ci-dev--web ... 
Attaching to django-first-ci-dev--web
django-first-ci-dev--web exited with code 0
Aborting on container exit...

Process finished with exit code 0

The container logs are empty. Why is the container with Django cut down? Thank you.

Dec 15, 2022 in DevOps & Agile by Edureka
• 12,690 points
648 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In DevOps & Agile

0 votes
1 answer
0 votes
1 answer

Docker for windows error: can’t access service on exposed port in windows container mode

You can try the following: Access container from different ...READ MORE

answered Dec 12, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
5,712 views
0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
1,234 views
0 votes
1 answer

Error: Unable to access elasticsearch in docker for windows

This is simple, just follow the below ...READ MORE

answered Sep 3, 2018 in DevOps & Agile by Sophie may
• 10,620 points
1,710 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP