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?
3 Replies
23 days ago
Hey there! We've found the following might help you get unblocked faster:
🧵 Can't create django superuser from railway shell or railway run
🧵 Railway CLI unable to create a superuser in my django project
🧵 How to create Django
superuser
with docker compose?
If you find the answer from one of these, please let us know by solving the thread!
22 days ago
try SSHing into your root project, run source /opt/venv/bin/activate
and try creating superuser from there
Attachments
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