Django (App Platform) Migrate Command raises ERROR: "could not translate host name '[...]' to address: Temporary failure in name resolution'

I re-deployed my Django App on DO’s app platform but I am facing a new issue that I did not encounter before. Once successfully deployed, when I try to go into the console and run Django’s Migrate Command (python migrate) the following error is raised:

django.db.utils.OperationalError: could not translate host name “app-[…]” to address: Temporary failure in name resolution

  1. The host name should be correct and in my App I use the following Environment Variables:
  1. My Database configuration in
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "HOST": os.getenv("POSTGRES_HOST"),
        "NAME": os.getenv("POSTGRES_DB"),
        "PASSWORD": os.getenv("POSTGRES_PASSWORD"),
        "USER": os.getenv("POSTGRES_USER"),
        "PORT": os.getenv("POSTGRES_PORT", 0),
  1. The Database is called db (default).

  2. I can connect to the database with the given connection details with my local PostgreSQL client.

I don’t know what else to try. Thanks in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Same, any solution?