Postgres connectivity with Django

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xcdruffle
    New Member
    • Mar 2020
    • 1

    Postgres connectivity with Django

    Hi,

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

    Code:
    File "C:\Python38\lib\site-packages\psycopg2\init.py", line 127, in connect
        conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    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.p y"

    Code:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'postgres',
            'USERNAME': 'postgres',
            'PASSWORD': 'root',
            'HOST': 'localhost',
            'PORT': '5431',
        }
    }
    I tried using the :

    Code:
    ALTER USER user_name WITH PASSWORD "password";
    But still the error persists.

    I even tried editing the "pg_hba.con f" 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!
Working...