Cannot connect postgres to my Django App

I have django application and wanted to host on render using postgres database. I have created the service and database and both are in same region. When I ran “makemigrations” it is showing "‘default’: could not translate host name “dpg-cm67ebocmk4c73cuc45g-a” to address: nodename nor servname provided, or not known
“. I can’t migrate my psql database to the render app. All I can see is the front end and when I try to login in the app it shows " OperationalError at /login/ no such table: auth_user” page. I tried researching it but I all I got was to check for the regions. This the database code in my settings.py file. Any help is appreciated!!!
if ‘DATABASE_URL’ in os.environ:
print(“Using the Postgres URL”)
database_url = os.environ.get(‘DATABASE_URL’)
parsed_database_url = dj_database_url.parse(database_url)
print(“Parsed DATABASE_URL:”, parsed_database_url)
DATABASES = {‘default’: parsed_database_url}
else:
print(“Postgres URL not found, using sqlite instead”)
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.sqlite3’,
‘NAME’: os.path.join(BASE_DIR, ‘db.sqlite3’),
}

Hi,

Screenshot seems to show the code is still using SQLite (“Exception Location”) and that it doesn’t contain an auth_user table (“Exception Value”).

You’ll need to ensuer your DATABASE_URL environment variable is defined, pointing to your Postgres service and that any migrations have been run to setup the required tables.

Alan

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