18 days 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?
3 Replies
Status changed to Open Railway • 18 days ago
18 days 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 • 18 days ago
17 days 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 • 17 days 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?
14 days ago
There's a variable called DATABASE_PUBLIC_URL which you can use.