E
E
ellz2019-03-05 03:58:36
Django
ellz, 2019-03-05 03:58:36

Why does the error "Error loading psycopg2 module: No module named 'psycopg2'" occur when connecting a database?

I connect the database like this:
settings.py :

DATABASES = {
    'default': {
                'ENGINE': 'django.db.backends.postgresql_psycopg2',#пробовал и просто postgresql
                'NAME': 'name',
    'USER': 'postgres',
    'PASSWORD': 'pass',
    'HOST': '127.0.0.1',
    'PORT': 5432,
    }
}

When starting the application on the line execute_from_command_line(sys.argv), an error occurs in the "manage.py" file -
Error loading psycopg2 module: No module named 'psycopg2
. Makemigrations/migrations done. Superuser created. The database has new tables. If I comment out DATABASES, it starts without errors, but I do not get access to the database.
pip install psycopg2 and psycopg2-binary did.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question