Good morning, I get this error when trying to connect django with postgressql:
Django.db.utils.OperationalError: conection to server at 'localhost" (::1), port 5432 failed: fe_sendauth: no password supplied
Using current versions of both PYCHARM AND POSTGRESSQL applications
Side note: Please do not post images of text-based information here. Copy/paste the text into the body of your post, surrounded between lines of three backtick - ` characters. This means you’ll have a line of ```, then the text, then another line of ```.
Please post your DATABASES setting from your settings.py.
DATABASES = { ‘default’: {
‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’, ‘NAME’: os.getenv(‘BD_NAME’),
‘USER’: os.getenv(‘BD_USER’), ‘PASSWORD’: os.getenv(‘BD_PASSWORD’),
‘HOST’: os.getenv(‘BD_HOST’), ‘PORT’: os.getenv(‘BD_PORT’),
}
my DATABASE configuration from your settings.py.
According to the error message you posted, you don’t have the BD_PASSWORD
environment variable set in the context in which you are running your project.
Also, as of Django 2.0, the preferred engine name is django.db.backends.postgresql
, not django.db.backends.postgresql_psycopg2
. See Django 2.0 release notes | Django documentation | Django
Thank you for your response. I write as django.db.backends.postgresql tells me but it keeps giving me the same error. Please help me with another solution. I haven’t found the solution to this error for a week.
Repeating my previous response:
This is the issue that needs to be addressed.
I have an .env file where the variable that tells me is configured but the problem still persists
Verify that you’re referencing that .env file in your settings.
Add a set of print statements before the DATABASES setting to verify that those settings are being read correctly.
Also, what version of Django and Python are you running?
The django version is 5.1b1