0

django.db.utils.OperationalError: could not translate host name "postgres.railway.internal"

0 django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: nodename nor servname provided, or not known my django project was working great, until a changed the setting.py file to deploy it in railway, using the variables railway provides. since then i can't runserv or migrate, that i get this error... here is the database settings a changed to use the railway variables DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'railway', 'USER': 'postgres', 'PASSWORD': DB_PASSWORD_RAIL, 'HOST': 'postgres.railway.internal', 'PORT': '5432', } } error when i runserver or migrate django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: nodename nor servname provided, or not known

22nd Jul 2024, 10:21 AM
vivan
2 RĂ©ponses
0
railway is not free. some of my projects were there... I moved all to vercel, and there is very easy to set the postgresql if you need railway, nothing else, at the moment I can't remember how to make it. but definitely try out vercel. >>> the MNY::dev project is built with django and hosted on vercel, using postgresql database
22nd Jul 2024, 11:20 AM
Mihaly Nyilas
Mihaly Nyilas - avatar
0
I have this in my `settings.py` file DATABASES = { "default": { 'ENGINE': 'django.db.backends.postgresql', 'NAME': os.getenv('POSTGRES_DATABASE'), 'USER': os.getenv('POSTGRES_USER'), 'PASSWORD': os.getenv('POSTGRES_PASSWORD'), 'HOST': os.getenv('POSTGRES_HOST'), 'PORT': os.getenv('POSTGRES_DB_PORT'), } } so possible you will need to use 'PASSWORD': os.getenv('DB_PASSWORD_RAIL') in case if there is a .env configuration
22nd Jul 2024, 11:47 AM
Mihaly Nyilas
Mihaly Nyilas - avatar