I encountered the following error while deploying my Django web app with the latest remote builder:
2.946 File "/usr/local/lib/python3.10/site-packages/psycopg/_conninfo_attempts.py", line 50, in conninfo_attempts
2.946 raise e.OperationalError(str(last_exc))
2.946 django.db.utils.OperationalError: [Errno -5] No address associated with hostname
it seems like psycopg can no longer find the DATABASE_URL correctly. The problem is gone with fly deploy --depot=false, so i guess the problem is from Depot.
Any suggestions for how to fix it with the new builder?
except that I changed the config file to the production one, which read the .env, which contains the DATABASE_URL. Running python manage.py migrate requires the connection to the database.
So I guess all Django apps have to be deployed with the --depot=false flag?
fly launch will have placed python manage.py migrate into your fly.toml as the release_command, which gets run in the production environment after the build. Your production environment likely has DATABASE_URL already set using fly secrets.
Running migrations in builds in not recommended. One reason: your production credentials in .env are embedded in the Docker image in the Fly Docker repository.