Trouble creating superuser django

AnonymousHOBBY

5 months ago

I'm unable to login as super user into a Django backend. More specifically I can't seem to create the user from Railway CLI locally.

I link my Django project with Railway link
then railway run python [manage.py](manage.py) cre..........
It successfully creates the superuser. When I goto my Railway deployed environment nothing has changed?

I must be missging a stage or miss understanding what to do here…….I tired adding the the creating command to my start but it doesn't allow it to run.

NOTE - i'm not connected to my Production db locally as I get a error

django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: No
such host is known.`

I pressume this is why. I need to connect o production db before running the Railway CLI obviosuly.

So how do I solve the host name error so I can connect to production. I have checked env varibles and they seem correct…production build is working and deployed.I just get this error when connecting locally.

I using dj_database in my django setting to parse the db adress held in my .env.

if live == True:
print("live)
DATABASES = {
'default': djdatabaseurl.config(default=os.getenv('DATABASE_URL'))
}

Project ID 314df6c0-152c-4a1a-b00a-815bc40f86b9

0 Replies

AnonymousHOBBY

5 months ago

Solved. This can be close.

Needed to connect to the public facing db domain.

EG… DATABASE_URL=postgresql://postgres:foobar@junction.foor.bar.net:40423/railway