2 years ago
When trying to access the database in production, this is the error I receive. When I run the project locally, the issue does not occur.
For reference, this is a Django project. Any idea as to why I may be running into this issue?
11 Replies
2 years ago
Are you using the private network to connect to the database? if not, please do.
2 years ago
I was not. Now, when I do try to change my 'HOST' to 'postgres.railway.internal' as the settings specify, I am now getting a host error. My settings are set up as follows:
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'railway',
'USER': 'postgres',
'PASSWORD': '***********************',
'HOST': 'postgres.railway.internal',
'PORT': '25924',Status changed to Awaiting Railway Response Railway • over 1 year ago
2 years ago
Please provide the error.
Are you on the V2 runtime? if not, try switching to it.
2 years ago
This is the local error when I try changing my HOST settings to 'postgres.railway.internal' :
django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.
2 years ago
I am on V2 runtime as well.
2 years ago
You can not connect to the private domain locally, please push the changes and see if your app once running on Railway can connect to the database now.
2 years ago
I just pushed it and got a different error in production:
could not translate host name "postgres.railway.internal" to address: Name or service not known2 years ago
No. The Django project is hosted on pythonanywhere. The postgres database is all that is in Railway.
2 years ago
Your django app and database would need to be in the same project in order to access the database over the private network, as it is now you are subjecting yourself to egress fees and increased latency.
2 years ago
Okay, thanks.
Status changed to Solved christian • over 1 year ago