2 months ago
Hello!
I've started my first railway project: a Django + Postgres website. I'm trying to run python manage.py createsupersuer through the railway cli to create my admin user but I'm getting this error:
django.db.utils.OperationalError: failed to resolve host 'postgres.railway.internal': [Errno -2] Name or service not known
The commands I've run are
railway login
railway link
railway service
railway run python manage.py createsuperuserThe database configuration in my django settings is done through dj_database_url
DATABASES = {
'default': dj_database_url.config(conn_max_age=600, conn_health_checks=True)
}
Am I missing something? What am I doing wrong?
Pinned Solution
2 months ago
There's a variable called DATABASE_PUBLIC_URL which you can use.
3 Replies
Status changed to Open Railway • 2 months ago
2 months ago
you're using internal url which can only be used internally from one service to another, use the public url instead
Status changed to Solved Railway • 2 months ago
2 months ago
OK, so how do I set it to use the public database url? Do I need a special settings file for when I connect to the shell?
Status changed to Awaiting Railway Response Railway • 2 months ago
mfrancisca
OK, so how do I set it to use the public database url? Do I need a special settings file for when I connect to the shell?
2 months ago
There's a variable called DATABASE_PUBLIC_URL which you can use.
Status changed to Solved 0x5b62656e5d • 17 days ago