Can't run railway run on Ubuntu
mfrancisca
HOBBYOP

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 createsuperuser

The 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?

$10 Bounty

3 Replies

Status changed to Open Railway 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


mfrancisca
HOBBYOP

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?

There's a variable called DATABASE_PUBLIC_URL which you can use.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...