difference between localhost and postgres for host in docker
问题 I am developing a django app and trying to run it inside docker. I have an issue that I could not understand so far. while running the app with docker-compose , it seems that the web app cannot connect to the database when i use these configurations: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'my_db', 'USER': 'my_user', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '5432', } but once I change the host to postgres , it works. like this DATABASES = {