How do you create a superuser for django

holderip
HOBBY

23 days ago

I'm deploying django from github. I can't figure out how to create a superuser for the database.

I tried to do this with the railway CLI using "railway run python manage.py create superuser" but get the error message "django.db.utils.OperationalError: could not translate host name "postgres.railway.internal" to address: nodename nor servname provided, or not known"

I'm using dj_database_url to parse the database url. I also tried setting in my production settings file the PUBLIC_DATABASE_URL instead of the DATABASE_URL to see if that would avoid the internal error. Yet, somehow when checking the value of settings using django shell function I still end up with the same postgres.railway.internal host of the regular DATABASE_URL.

Is there some other easy way to run python manage.py createsuperuser on the server?

Solved$10 Bounty

3 Replies

Railway
BOT

23 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Anonymous
HOBBY

22 days ago

try SSHing into your root project, run source /opt/venv/bin/activate and try creating superuser from there

Attachments


holderip
HOBBY

22 days ago

This worked, thank you! I tried it without enabling the virtual environment, and it worked.


Status changed to Solved noahd 22 days ago


How do you create a superuser for django - Railway Help Station