Hello I occured an error like in title during composing Django web app. I get this error
Is the server running on host "localhost" (::1) and accepting
web_1 | TCP/IP connections on port 5432?
I have no idea how can i solve it, I have already, restarted Postgresql database and docker but I neither of these work.
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fitshop',
'USER': 'fitshopuser',
'PASSWORD': 'fitpass',
'HOST': 'localhost',
'PORT': '5432',
}
}
docker-compose.yml
version: "3"
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=fitshopuser
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db