For those who are getting error: django.db.utils.operationalerror: could not translate host name "db" to address: temporary failure in name resolution You should consider adding the addiotional configs to your docker-compose file: db: image: postgres ports: - 5432:5432 volumes: - pgdata:/var/lib/postgresql/data - pgconf:/etc/postgresql - pglog:/var/log/postgresql environment: - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres container_name: postgres_db volumes: pgdata: driver: local pgconf: driver: local pglog: driver: local
Excellent, But I am getting some error which can't be resolved by me. Can you help me on that.... django.db.utils.OperationalError: could not translate host name "db" to address: Temporary failure in name resolution
Hi Kaushal, difficult to fully diagnose without seeing the code. Presume you have named the db service db in the docker file. Best way for me to help you and anyone else if to start a stack overflow post and put the link in here. stackoverflow.com/questions/41573313/docker-compose-with-django-could-not-translate-host-name-db-to-address-name-o
Hi , anyone with this error ? : raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) django-container2 | django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'. (UPDATE Fix) I had to delete my previous app image and create it again so it could install the psycopg2-binary package.
You dont need to. However, once things start to scale then you find that might be the most effective way to work. Also it is easier to manage services this way.
Thanks Ayesh I have a running order from other members requests. 6. Deploy to Heroku 7. Django + React 8. Deploy to Digital Ocean 9. PostGres PGAdmin setup
What do you mean? I'm learning Docker too but when you want to do a migration in your local machine you gotta do it through your OS command prompt. In this case as you are running the django app in a Linux OS container you need to do it via Bash?