By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,470 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,470 IT Pros & Developers. It's quick & easy.

Postgres connectivity with Django

P: 1
Hi,

I'm stuck with setting up PostgreSQL with Django
Every time I run Django server it shows :

Expand|Select|Wrap|Line Numbers
  1. File "C:\Python38\lib\site-packages\psycopg2\init.py", line 127, in connect
  2.     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
  3. django.db.utils.OperationalError: FATAL:  password authentication failed for user "Test"
Here the user "Test" is my OS username and I'm running the database with default postgres user and a "password" which I've already defined in my Django "settings.py"

Expand|Select|Wrap|Line Numbers
  1. DATABASES = {
  2.     'default': {
  3.         'ENGINE': 'django.db.backends.postgresql',
  4.         'NAME': 'postgres',
  5.         'USERNAME': 'postgres',
  6.         'PASSWORD': 'root',
  7.         'HOST': 'localhost',
  8.         'PORT': '5431',
  9.     }
  10. }
I tried using the :

Expand|Select|Wrap|Line Numbers
  1. ALTER USER user_name WITH PASSWORD "password";
But still the error persists.

I even tried editing the "pg_hba.conf" file and manually added "trust" method for all users on my "localhost" but no help.

I'm running Postgres12 on Windows 10

Can you please guide me through this in what I might be doing wrong?

Thanks!
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.