Migration error from postgres and django

I get this error anytime i run makemigrations:

/home/azeez/bendownselect/venv/lib/python3.12/site-packages/django/core/management/commands/makemigrations.py:160: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': could not translate host name "postgres" to address: Temporary failure in name resolution

and i get this error if i run migrate:

django.db.utils.OperationalError: could not translate host name "postgres" to address: Temporary failure in name resolution

this is my db config:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': env("POSTGRES_DB"),
        'USER': env("POSTGRES_USER"),
        'PASSWORD': env("POSTGRES_PASSWORD"),
        'HOST': env("POSTGRES_HOST"),
        'PORT': env("POSTGRES_PORT"),  
    }
}

Thank you!

What is your environment setting for POSTGRES_HOST? What PostgreSQL server are you trying to connect to?

What do you think this error may be telling you?

I have no clue. I deleted my migrations folder and ran the steps it still gives the same error.

The postgres am using is a service from railway, i tried the one on my local machine also same error

Again:

Or, to clarify that second question, what is the host name or IP address for the PostgreSQL server you’re trying to use?

Also, see the docs for DATABASES to understand what these settings are supposed to do.

sorry this is how they look.

POSTGRES_HOST=monorail.proxy.rlwy.net
POSTGRES_PORT=34454
POSTGRES_DB=railway
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password

And the PostgreSQL server you’re trying to use is at roxy.rlwy.net, listening on port 34454?

You’ll need to find some way to verify that, along with the database name and credentials.

What other ways have you connected to that database?

Through DBeaver-ce and it works.

Then the next step would be for you to post your complete settings file to ensure there’s not something else in that file causing a problem.

Also I might suggest you print the DATABASES setting after it’s defined for you to verify that the environment variables being used by the process are what you’re expecting them to be.

I got it fixed the error came from my .env because zsh loaded it before i added the new database credentials so i closed and opened it again and it works thank you.