Cannot connect postgres service with the web service (Django project)

Hello fellows, I’m facing a problem with configuration in docker-compose.yml file, I want to connect the postgres and the web (django project) in order to retrieve data, so this it my file

version: "3.7"

services:
  web:
    build: .
    restart: always
    command: >
      sh -c "
       python app/manage.py collectstatic --noinput --clear --settings=dashboard.settings && \
       xvfb-run -a python app/manage.py runserver 0.0.0.0:8000 --settings=dashboard.settings"
    environment:
      - POSTGRES_NAME=dash
      - POSTGRES_USER=db
      - POSTGRES_PASSWORD=cau****
      - DISPLAY=0
      - QT_X11_NO_MITSHM=1
    volumes:
      - ./dashboard:/app
      - ./faces:/app/faces
      - /tmp/.X11-unix:/tmp/.X11-unix
    ports:
      - "8000:8000"
    devices:
      - "/dev/video0:/dev/video0"
    privileged: true
    networks:
      - dash_net
    depends_on:
      - db
    cap_add:
      - SYS_ADMIN
      - DAC_READ_SEARCH
    security_opt:
      - seccomp:unconfined

  db:
    image: postgres:13
    command: ["postgres", "-c", "log_statement=all"]
    restart: always
    volumes:
      - "db:/var/lib/postgresql/data"
    networks:
      - dash_net
    environment:
      - POSTGRES_USER=db
      - POSTGRES_PASSWORD=ca*****
      - POSTGRES_HOST=dash.postgres.****
    ports:
      - "5432:5432"

networks:
  dash_net:
    driver: bridge

volumes:
  db:

You explicitly create a Docker network, that’s great.

Are you aware that the services/containers are then available via their service name, so your DB at “hostname” db?

You can also set an additional alias if you wish.

actually i’m not the creator of this file ! but i feel like its not correctly configured! so I have some knowledge about docker and containers, but the basic stuff