I want to deploy my django w postgres thanks to docker and I get an error like: django.db.utils.OperationalError: could not translate host name "db" to address: Name or service not known
This is my docker-compose :
version: '3'
services:
db:
image: postgres
environment:
POSTGRES_USER: alban
POSTGRES_PASSWORD: ***
POSTGRES_DB: plateforme
restart: always
ports:
- "5432:5432"
web:
build: ./plateforme_v2_1
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
This is my setting.py :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'plateforme',
'USER': 'alban',
'PASSWORD': '***',
'HOST': 'db',
'PORT': '5432',
}
}
Does anyone here already get this problem ?
Thx