将PostgreSQL10.8与django2.1.3连接时遇到问题

时间:2019-06-04 06:37:27

标签: django postgresql ubuntu-18.04

我是django和postgresql的初学者,我试图连接数据库,但是在运行“ python manage.py makemigrations”时出错:

   File "/home/trainee/portfolio/venvportfolio/lib/python3.6/site- 
   packages/psycopg2/__init__.py", line 130, in connect
   conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
   django.db.utils.OperationalError: SSL error: unknown protocol
   expected authentication request from server, but received S

requirement.txt:

Django==2.1.3
Pillow==6.0.0
psycopg2==2.7.4
psycopg2-binary==2.7.4
pytz==2019.1

settings.py:

DATABASES = {


    'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'portfolio',
    'USER': 'username',
    'PASSWORD': 'password',
    'HOST': 'localhost',
    'PORT': '22'
    }

  }

Screenshot of errors

0 个答案:

没有答案