I am trying to host my PostgreSQL database on Supabase from my Django project. I had success a few weeks ago with the same tech stack. I think the problem has to do with using django dotenv, but I followed the same steps and updated the same code as my last project.
The error message: django.db.utils.OperationalError: connection to server at “aws-0-us-west-1.pooler.supabase.com” (52.8.172.168), port 5432 failed: FATAL: Tenant or user not found
If I put the password directly in settings.py, it will connect to Supabase no problem but it doesn’t feel secure to have the password commited to Github.
If I put the info directly into the terminal shell, I’m able to access the database and make queries no problem.
Once I use dotenv, it won’t connect.
Here is the code:
from dotenv import load_dotenv
import os
load_dotenv()
…
‘USER’: str(os.getenv(‘SUPA_USER’)),
‘PASSWORD’: str(os.getenv(‘SUPA_PW’)),
kimmykokonut is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.