After deployment getting error 500 and 403 after trying to access DB.

Hey everyone!

I’ve deployed my Django app and used the flyctl launch command to link the database. Everything passed and the website works - except when I try to access the database.

I get a server error 500 when trying to recall information from it and error 403 if I try to create a user account.

Also, now that I have a new database how would I set up the superuser? With Django I would normally have to migrate to the database to set it up but since were using a docker container I’m unsure if those steps are still necessary.


Alright made lots of progress on this and here are the steps that I’ve done.

I’ve used the flyctl ssh console -C ‘python migrate’ which threw me into another set of errors (flyctl doctor is really helpful here!) and I am unsure how to navigate.

django.db.utils.OperationalError: could not translate host name “db” to address: Name or service not known

I’ve set the DATABASE_URL to the path of my DB in the secrets. The DB is linked with the app (did this during launch) I’ve tried attaching it just to make sure with no avail. I’ve confirmed I’m using the right username, password and database connection in the DATABASE_URL. I’ve tried to re-launch it and, still, same error.

Any tips on connecting the database to the app?