How to add a Django service to the Existing Docker application

Hey Everyone :wave:
I am trying to add a basic django project → Printing-service to the Existing system
and i am getting this error. It is working fine Locally[Just initialised]

and i have a follow on question do we have to declare/intialise early all the services in yml when we are sharing volumes.

2023-11-09 14:56:57 Traceback (most recent call last):
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
2023-11-09 14:56:57     self.execute(*args, **cmd_options)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 74, in execute
2023-11-09 14:56:57     super().execute(*args, **options)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
2023-11-09 14:56:57     output = self.handle(*args, **options)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 81, in handle
2023-11-09 14:56:57     if not settings.DEBUG and not settings.ALLOWED_HOSTS:
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
2023-11-09 14:56:57     self._setup(name)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
2023-11-09 14:56:57     self._wrapped = Settings(settings_module)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
2023-11-09 14:56:57     mod = importlib.import_module(self.SETTINGS_MODULE)
2023-11-09 14:56:57   File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
2023-11-09 14:56:57     return _bootstrap._gcd_import(name[level:], package, level)
2023-11-09 14:56:57   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2023-11-09 14:56:57   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2023-11-09 14:56:57   File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2023-11-09 14:56:57 ModuleNotFoundError: No module named 'printing.settings'

this is my .yml configuration

version: '3.8'

services:
  cartonprintingsystem:
    build: 
      context: ./cartonprintingsystem
      dockerfile: Dockerfile
    command: python manage.py runserver 0.0.0.0:8000
    ports:
      - "8000:8000"
    # volumes:
    #   - ./cartonprintingsystem:/app
    volumes:
      - carton-printing:/app 
    networks:
      - Carton

  inspection_service:
    build:
      context: ./inspection_service
      dockerfile: Dockerfile
    command: python manage.py runserver 0.0.0.0:8001
    ports:
      - "8001:8001"
    volumes:
      - carton-printing:/app 
    environment:
      - DJANGO_SETTINGS_MODULE=inspection_service.settings
    networks:
      - Carton

  printing_service:
    build:
      context: ./printing
      dockerfile: Dockerfile
    command: python manage.py runserver 0.0.0.0:8002
    ports:
      - "8002:8002"
    volumes:
      - carton-printing:/app 
    environment:
      - DJANGO_SETTINGS_MODULE=printing.settings
    networks:
      - Carton

  phpMyAdmin:
    image: phpmyadmin
    environment:
      PMA_ARBITRARY: 1
    ports:
      - "9090:80"

  broker:
    image: confluentinc/cp-kafka:7.5.0
    container_name: broker
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_PROCESS_ROLES: broker,controller
      KAFKA_NODE_ID: 1
      KAFKA_CONTROLLER_QUORUM_VOTERS: 1@broker:29093
      KAFKA_LISTENERS: PLAINTEXT://broker:29092,CONTROLLER://broker:29093,PLAINTEXT_HOST://0.0.0.0:9092
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
      KAFKA_LOG_DIRS: /tmp/kraft-combined-logs
      CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
    networks:
      - Carton

volumes:
  carton-printing:

networks:
  Carton:

Seems like a missing library. Maybe you didn’t copy it over or you didn’t run the install in Dockerfile or it’s missing in the package list, or …

Sorry, I don’t understand the volume question. What do you want to achieve?