Trouble creating superuser django
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 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': dj_database_url.config(default=os.getenv('DATABASE_URL'))
}
Project ID 314df6c0-152c-4a1a-b00a-815bc40f86b9Solution:Jump to solution
Solved. This can be close.
Needed to connect to the public facing db domain before running superuser command.
EG... DATABASE_URL=postgresql://postgres:[email protected]:40423/railway...
2 Replies
Project ID:
314df6c0-152c-4a1a-b00a-815bc40f86b9
Solution
Solved. This can be close.
Needed to connect to the public facing db domain before running superuser command.
EG... DATABASE_URL=postgresql://postgres:[email protected]:40423/railway