Deploy error: psycopg2 can't translate host name to address

Thanks for the help in my previous post.

However, I am having a new problem with my deploy of the Django deploy tutorial.

After processing static files, I get a new error:

 psycopg2.OperationalError: could not translate host name "dpg-ccpqbkaen0hr84ndrafg-a" to address: Name or service not known

I followed the Manual Deploy as instructed in the tutorial. After installing dj-database-url, I added the configuration to the DATABASES setting in Django’s setting.py and added the DATABASE_URL environment variable with the internal URL my database.

Part of the tutorial involves adding the following code to my settings.py:

ALLOWED_HOSTS = []
RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME')
if RENDER_EXTERNAL_HOSTNAME:
    ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME)

Perhaps this is relevant?

Thanks for your help.

Micah

Hi Micah,

Can you double check that your service and the database are in the same region?

They aren’t. Should they be?

I made a new web service in the same region as my database and fixed that problem, thanks!

Same problem here S:

I have a fastaapi service and postgres in the same region oregon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.