I got this error when is makemigrations
The databe setting for database in setting.py is:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'freecodeschool',
'USER': 'fcs_admin',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
when i run migrations i got this error.
return func(*args, **kwargs)
File "/home/danish-khan/django_drf/django/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/danish-khan/django_drf/django/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: fe_sendauth: no password supplied
and when i supply the password then it give me this error.
connection = Database.connect(**conn_params)
File "/home/danish-khan/django_drf/django/lib/python3.8/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 "fcs_admin"
FATAL: password authentication
it seems you haven't filled PASSWORD and your db wants it for user "fcs_admin". beside that you should add your db PORT too. (default is 5432) if you're not sure about postgres users' password you can use these commands:
sudo su postgres
\du
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.