could not translate host name "postgres.railway.internal" to address: No such host is known.

olim8
TRIAL

a year ago

Hello, i'm trying to add cloud postgres db to my app and this error is occuring:
django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: No such host is known.

My setting.py

from dotenv import load_dotenv

load_dotenv()
DATABASES = {
    'default': {
        # 'ENGINE': 'django.db.backends.sqlite3',
        # 'NAME': BASE_DIR / 'db.sqlite3',
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'railway',
        'USER': 'postgres',
        'PASSWORD': os.environ.get('DB_PASSWORD_YO'),
        'HOST': 'postgres.railway.internal',
        'PORT': '5432',
    }
}
How can i resolve this?

3 Replies

a year ago

When developing locally you would need to use the public host and port, you can find that in the service settings.


Can you detail that please ı am having the same error and not sure what you meant sir


thel0nelyg0d

Can you detail that please ı am having the same error and not sure what you meant sir

mohamed7422
TRIAL

7 months ago

Did u find a solution?