alstr
alstr

Reputation: 1556

Django 3.x error: 'mysql.connector.django' isn't an available database backend

Having recently upgraded a Django project from 2.x to 3.x, I noticed that the mysql.connector.django backend (from mysql-connector-python) no longer works. The last version of Django that it works with is 2.2.11. It breaks with 3.0. I am using mysql-connector-python==8.0.19.

When running manage.py runserver, the following error occurs:

django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'

I am aware that this is not an official Django backend but I have to use it on this project for reasons beyond my control.

I am 80% sure this is an issue with the library but I'm just looking to see if there is anything that can be done to resolve it beyond waiting for an update.

UPDATE:

mysql.connector.django now works with Django 3+.

Upvotes: 8

Views: 7253

Answers (3)

ichbinrasoul
ichbinrasoul

Reputation: 1

in settings.py change database engine this way 'ENGINE': 'django.db.backends.mysql'

Upvotes: -2

obotezat
obotezat

Reputation: 1135

For Django 3.0 and Django 3.1 I managed to have it working with mysql-connector-python 8.0.22. See this https://dev.mysql.com/doc/relnotes/connector-python/en/news-8-0-22.html.

Upvotes: 5

Nuno Mariz
Nuno Mariz

Reputation: 591

Connector/Python still supports Python 2.7, which was dropped by Django 3. We are currently working on adding support for Django 3, stay tunned.

Upvotes: 2

Related Questions