9 months 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
9 months ago
Are you using the private network to connect to the database? if not, please do.
9 months 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[bot] • 9 months ago
9 months ago
Please provide the error.
Are you on the V2 runtime? if not, try switching to it.
9 months 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.
9 months ago
I am on V2 runtime as well.
9 months 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.
9 months 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 known
9 months ago
No. The Django project is hosted on pythonanywhere. The postgres database is all that is in Railway.
9 months 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.
9 months ago
Okay, thanks.
Status changed to Solved christian • 9 months ago