M
M
MindStorm2020-10-19 12:44:47
PostgreSQL
MindStorm, 2020-10-19 12:44:47

What is wrong with connecting to the database?

Help plz, ran into an error in connecting Django to Postgres

sudo -u postgres psql
create database base;
create user userwith password 'password';
alter role userset client_encoding to 'utf8';
alter role user SET default_transaction_isolation to 'read committed';
alter role user set timezone to 'UTC';
grant all privileges on database base to user;
\q


settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'base',
        'USER': 'user',
        'PASSWORD': 'password',
        'HOST': '127.0.0.1',
        'PORT': '',
    }
}


I'm trying to make a migration - it gives
FATAL: password authentication failed for user "user"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zerg89, 2020-10-19
@Zerg89

space missing, user not created or created userwith without password
create user userwith password 'password';
create user user with password 'password';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question