TUK-3oon / hello-tarot-BE

hello-tarot project BackEnd
0 stars 1 forks source link

django.db.utils.OperationalError: could not translate host name "db" to address: nodename nor servname provided, or not know #3

Closed hellojunho closed 5 months ago

hellojunho commented 5 months ago

This error occur when i try command "python manage.py migrate"

I checked this error's cause but I can't resolve this error.

error message

django.db.utils.OperationalError: could not translate host name "db" to address: nodename nor servname provided, or not know
kim-song-jun commented 5 months ago

I think that error occured by db name. I will check it

kim-song-jun commented 5 months ago
image

Hi, I hope you must be run python migration command in docker images you can exec docker image using this command docker exec -it 'image name' /bin/bash

image name can find in this command docker ps

and in docker image, you can run these commands python3 manage.py migrate

python3 manage.py makemigrations

kim-song-jun commented 5 months ago
image

In docker, all of our service will run on docker image. so we must run our command in docker image. e.g. collectstatics, migrate, makemigrations, run server

hellojunho commented 5 months ago

Thank you! I'm able to solve the problem thanks to your help!