2
votes

I'm banging my head against a wall here. I need another set of eyes. This is error I get:

django.db.utils.OperationalError: FATAL: password authentication failed for user "localproject" FATAL: password authentication failed for user "localproject"

I have set up the database like this in the settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'project',
        'USER': 'localproject',
        'PASSWORD': 'MahPassword',
        'HOST': 'localhost',
        'PORT': '',
    }
}

And I have created the Scheme like this:

postgres=# CREATE DATABASE project;

Set the user like this:

postgres=# CREATE USER localproject WITH PASSWORD 'MahPassword';

Set the priviligies for the scheme like this:

postgres=# GRANT ALL PRIVILEGES ON DATABASE project TO localproject ;

And the database list looks like this:

postgres=# \l

                               List of databases
Name    |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges
-----------+----------+----------+-------------+-------------+------------------------
 project   | postgres | UTF8     | en_CA.UTF-8 | en_CA.UTF-8 |=Tc/postgres           +
       |          |          |             |             | postgres=CTc/postgres  +
       |          |          |             |             | localproject=CTc/postgres

Why on earth do I get the error?

1
can you try DROP DATABASE project; CREATE DATABASE project OWNER localproject;? - Brown Bear
@BearBrown Yes, but I get same result. - sumpen

1 Answers

0
votes

It works after restart.

Restart by using this line:

sudo service postgresql restart