471,873 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Postgres connectivity with Django


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?

Mar 18 '20 #1
0 2535

Post your reply

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

Similar topics

28 posts views Thread by flamesrock | last post: by
13 posts views Thread by Ilias Lazaridis | last post: by
1 post views Thread by kernel1983 | last post: by
4 posts views Thread by seb.haase | last post: by
4 posts views Thread by K | last post: by
reply views Thread by imhomer | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.