2 years ago
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 settings.py file to migrate to railway, using railway variables.
now i can't runserver, or migrate, and i get this error...
please help
22 Replies
2 years ago
Yes, the project was working...
here is my database settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'railway',
'USER': 'postgres',
'PASSWORD': DB_PASSWORD_RAIL,
'HOST': 'postgres.railway.internal',
'PORT': '5432',
}
}2 years ago
Following this, as I'm also getting the same error.
2 years ago
yayadrian, there is a multitude of common mistakes you can make to get this error, please open your own thread instead.
2 years ago
please excuse my ignorance, however i don't know what v2 runtime is...
i'm on a mac
running everything from the VScode terminal
2 years ago
My question was in relation to your Railway service, not your own computer.
Check your service settings.
2 years ago
just checked it
it's v2
2 years ago
That's the thing...
i just started a new project, and did nothing...
so it's just a new project in railway, with nothing done to it...
i'll attach the screenshot anyway..
2 years ago
as i said.... i have nothing in my railway... so i got a screenshot of the project settings
Attachments
2 years ago
my django project is in my mac
local
i was going to start to up the project to railway
the first step was to create an account, get the variables from railway, then run "python3 manage.py migrate" command to migrate the database to railway and start the process in railway
i'm following the videos from codemy \ channel (ecommerce project)
2 years ago
my django project is in my mac
local
i was going to start to up the project to railway
the first step was to create an account, get the variables from railway, then run "python3 manage.py migrate" command to migrate the database to railway and start the process in railway
i'm following the videos from codemy \ channel (ecommerce project)
2 years ago
my django project is in my mac
local
i was going to start to up the project to railway
the first step was to create an account, get the variables from railway, then run "python3 manage.py migrate" command to migrate the database to railway and start the process in railway
i'm following the videos from codemy \ channel (ecommerce project)
2 years ago
You can not connect to the private domain locally, it would not be very private if you could, you need to use the public host and port.
2 years ago
so instead of using the variable PGHOST i should use DATABASE_PUBLIC_URL as HOST in my setting.py file?
2 years ago
again excuse my ignorance, but...
where do i get those variables? public host and port....
and thank you so much for your help
2 years ago
i'm using the trial from railway
i couldn't find any public host here
i ran more tests connecting, and got the same error, even from a new terminal, out of the project...
2 years ago
You need to use the public host and port, open the database and then open its settings and you will see the public host and port.
Marking as solved since I am confident this is the issue and at this point I've just been repeating myself.
Status changed to Solved brody • over 1 year ago
