Reputation:
I am trying to migrate an app from Django 1.8 and Python 2 to Python 3.6 and Django 3.0.
Whenever I am adding django.db.backends.postgresql_psycopg2
, and installing it via pip3 I am getting this error:
_psycopg2 module not found.
I looked at the documentation, and I see that in Django 3.0 _psycopg2 is removed. How can I resolve this issue? My previous app is running psycopg 2.6.1.
Upvotes: 6
Views: 7899
Reputation: 8242
The correct setting to use in Django 3.0 is 'django.db.backends.postgresql'
.
From the Django deprecation timeline:
The django.db.backends.postgresql_psycopg2 module will be removed.
This particular module has actually been deprecated since Django 2.0:
The django.db.backends.postgresql_psycopg2 module is deprecated in favor of django.db.backends.postgresql. It’s been an alias since Django 1.9. This only affects code that imports from the module directly. The DATABASES setting can still use 'django.db.backends.postgresql_psycopg2', though you can simplify that by using the 'django.db.backends.postgresql' name added in Django 1.9.
From the databases docs, it looks like your version of psycopg2
should be supported, as you need 2.5.4 or higher.
Upvotes: 13