| Bug #99106 | Connector / Python error with Django 3.x | ||
|---|---|---|---|
| Submitted: | 30 Mar 2020 8:35 | Modified: | 9 Feb 2022 13:07 |
| Reporter: | Alastair Mooney | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S1 (Critical) |
| Version: | 8.0.19, 8.0.21 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Django, python | ||
[6 Jun 2020 17:42]
Jack Ostroff
Is this perhaps because of lack of python3 support in general? (I don't use django myself, so I have no easy way to check.)
[6 Jun 2020 17:50]
Alastair Mooney
No, both Django and Connector / Python work just fine with Python 3. I can use Connector / Python 2.2.11 and everything works as expected. The issue I believe is more a lack of support for Django 3.x. The `mysql.connector.django` backend needs updating by the looks of it. Would be nice to see this done as soon as possible as it is holding other things back.
[6 Jun 2020 17:56]
Alastair Mooney
That should say Django 2.2.11 works just fine with Connector / Python and Python 3. Upgrading Django to 3.x causes the connector to error.
[14 Jul 2020 18:36]
Manujith Pallewatte
I added a PR with a fix for this, https://github.com/mysql/mysql-connector-python/pull/62 Please review when possible. I'm hoping that it would get released before the project i'm currently working on go live :)
[14 Jul 2020 20:24]
MySQL Verification Team
Please try 8.0.21 version. Thanks.
[16 Jul 2020 15:42]
Alastair Mooney
This is not resolved. with Django 3.0.8 and Connector / Python 8.0.21, I still get the following error:
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 updating this to Critical as there is no workaround other than to stay on Django 2.2.11, which is not realistic.
Is there any update on this? May be connected to: https://bugs.mysql.com/bug.php?id=99069
[20 Aug 2020 8:55]
MySQL Verification Team
Hello Alastair Mooney, Thank you for the report and feedback. regards, Umesh
[20 Aug 2020 9:06]
MySQL Verification Team
- VS 2019, Python 3.7, MySQL Connector/Python 8.0.21 and Django-3.1 asgiref-3.2.10 pytz-2020.1 sqlparse-0.3.1
Attachment: 99106.results.txt (text/plain), 5.41 KiB.
[9 Feb 2022 13:07]
MySQL Verification Team
From internal bug progress, this issue is already fixed by WL#13380 More details in https://dev.mysql.com/doc/relnotes/connector-python/en/news-8-0-22.html

Description: Having recently upgraded Django from 2.x to 3.x, I noticed that the `mysql.connector.django` backend no longer works. The last version that works is 2.2.11. It breaks with 3.0. 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' How to repeat: 1. Create a project with Django >= 3.0 and Connector / Python == 8.0.19. 2. Set the database backend in `settings.py` to `mysql.connector.django`. 3. Run `manage.py runserver`. Suggested fix: Consult the Django 3.0 release notes on the database backend API: https://docs.djangoproject.com/en/3.0/releases/3.0/#database-backend-api