9 months 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
9 months 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',
}
}
9 months ago
Following this, as I'm also getting the same error.
9 months ago
yayadrian, there is a multitude of common mistakes you can make to get this error, please open your own thread instead.
9 months 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
9 months ago
My question was in relation to your Railway service, not your own computer.
Check your service settings.
9 months ago
just checked it
it's v2
9 months 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..
9 months ago
as i said.... i have nothing in my railway... so i got a screenshot of the project settings
Attachments
9 months 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)
9 months 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)
9 months 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)
9 months 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.
9 months ago
so instead of using the variable PGHOST i should use DATABASE_PUBLIC_URL as HOST in my setting.py file?
9 months ago
again excuse my ignorance, but...
where do i get those variables? public host and port....
and thank you so much for your help
9 months 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...
9 months 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 • 10 months ago