10 months ago
While trying to connect my application to my database I received the error: "psycopg2.OperationalError: could not translate host name "postgres.railway.internal" to address: Name or service not known". I connected the postgreSQL variable DATABASE_URL to my application variables. And it has the right link in my program (tested by using a print statement and got: postgresql://postgres:password@postgres.railway.internal:5432/railway).
ⓘ Deployment information is only viewable by project members and Railway employees.
3 Replies
10 months ago
The DATABASE_URL variable is empty, please make sure to use a reference variable in its place, then once you are no longer hardcoding the URL in your code and have started using the environment variable, go into your service settings and enable the new builder since this error is being printed in your build logs.
10 months ago
Thank you so much this worked! (sorry for the mildly annoying question I did not see the new builder section )
10 months ago
No worries, looks like you are now using a reference variable in Railway, just make sure you are using that environment variable in code instead of hardcoding it.
Status changed to Solved brody • 10 months ago