reuse one container for tests, manage.py tasks, server, django-console, etc
Answered
Hi
Is
it possible to somehow use only one docker container for running
Django server, Django-console, manage.py tasks, tests, etc.
At
the moment Pycharm uses new container for each process and they
can’t work simultaneously.
That is if I need to run unit tests, for example, it would stop
server, django-console and all other processes
that depend on docker container running. So after tests I need to
manually run server again, launch Django-console
again, etc. Each tasks aborts all other tasks.
docker-compose.yaml:
version: '3.8'
volumes:
postgres_data:
redis_data:
services:
web:
build: .
command: python /code/manage.py runserver 0.0.0.0:8000
env_file:
- ./series/.env
volumes:
- .:/code
ports:
- 8000:8000
depends_on:
- db
- redis
- celery
- celery-beat
links:
- db
db:
build:
context: .
dockerfile: postgres.dockerfile
restart: always
env_file:
- ./series/.env
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
volumes:
- postgres_data:/var/lib/postgresql/data/
ports:
- target: 5432
published: 5433
protocol: tcp
mode: host
redis:
image: redis:alpine
command: redis-server --appendonly yes
ports:
- target: 6379
published: 6380
protocol: tcp
mode: host
volumes:
- redis_data:/data
restart: always
environment:
- REDIS_REPLICATION_MODE=master
celery:
build: .
command: celery worker -A series --loglevel=INFO --concurrency=4 -E
restart: always
environment:
- C_FORCE_ROOT=1
volumes:
- .:/code
depends_on:
- db
- redis
celery-beat:
build: .
command: celery -A series beat --loglevel=INFO --pidfile=
restart: always
volumes:
- .:/code
depends_on:
- db
- redis

Please sign in to leave a comment.
Hi,
Unfortunately, it's a known problem https://youtrack.jetbrains.com/issue/PY-18977, please upvote to help us prioritize it and feel free to comment.