9 months ago
I am running Django + Postgres. Recently, I added Uvicorn to support async. Since the default run command is typically 'runserver', I added a Procfile to my project to use a 'gunicorn' command. All of this works without issue.
However, database migrations ('python manage.py migrate') don't seem to be occurring, presumably because of the switch to the Procfile. I've tried adding a 'release: python manage.py migrate' line, but this fails, presumably because the database hasn't started when the command runs.
psycopg2.OperationalError:
May 05 07:37:24
could not translate host name "postgres.railway.internal" to address: Name or service not known
I'm curious what the best way to resolve this is. Claude suggests replacing the command with a script that retries a few dozen times. The docs indicate that "You can control the order your services start up with Reference Variables," but I ensured that my Django service has a reference variable to the Postgres database and that doesn't seem to have resolved anything.
0 Replies