Django connect to another container

Hello everybody,

I am trying to start to use django and docker, but I don’t know how to connect the django container with another container with postgresql, I have a postgresql container, what I read is how to make a container with django and postgresql, but I need It in different container:

My files are:
Dockerfile:

FROM python:3.6

ENV PYTHONUNBUFFERED=1
ENV WEBAPP_DIR=/webapp

RUN mkdir $WEBAPP_DIR

WORKDIR $WEBAPP_DIR

ADD requirements.txt $WEBAPP_DIR/

RUN pip install -r requirements.txt

ADD . $WEBAPP_DIR/

Requirements.txt:

django==2.0.1
psycopg2==2.7.3.2

docker-compose.yml:

version: "2.0"

services:
   db:
      image: postgres:10.1
      environment:
         - POSTGRES_DB=ecommerce
         - POSTGRES_USER=usuario
         - POSTGRES_PASSWORD=123456
         - PGDATA=/var/lib/postgresql/data/pgdata
      volumes:
         - db_data:/var/lib/postgresql/data/pgdata
      ports:
         - "5432:5432"
         
   web:
      build: .
      command: python manage.py runserver 0.0.0.0:8000
      volumes:
         - .:/webapp
      ports:
         - "8000:8000"
      depends_on:
         - db

volumes:
   db_data:
      external: true

In the previuos file, the service db is in the same container, but in my case, I have the container postggresql yet,

How do I change my docker-compose.yml to link my another postgresql container?

Thank you in advance for your help