Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#24355 closed Uncategorized (invalid)

Cannot use Django 1.8a1 with mysql.connector.python (Oracle's official mysql connector.)

Reported by: LEE U BILL Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8alpha1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I have Django 1.8a1 and mysql-connector-python 2.0.3 installed.

I get this error, reproducable by setting ENGINE as below in the settings.py.
And then running the command line python manage.py startapp polls

DATABASES = {

'default': {

#'ENGINE': 'django.db.backends.mysql',
'ENGINE': 'mysql.connector.django',

The error happens at django.apps.config.py at around line 202:
self.models_module = import_module(models_module_name)

Partial stack trace (this error is reproducable anyhow.)

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

u'base', u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'

Error was: cannot import name BaseDatabaseFeatures

My OS is Debian Wheezy.

Change History (4)

comment:1 by Tim Graham, 9 years ago

Resolution: invalid
Status: newclosed

The connector likely hasn't been updated to be compatible with Django 1.8.

comment:2 by Aymeric Augustin, 9 years ago

To clarify — mysql-connector-python is developed independently by Oracle. The Django team doesn't have any control over that component.

Django 1.8 is still under development. The documentation of mysql-connector-python doesn't say which versions of Django are supported but mentions Django 1.5 a few times.

It's unclear which versions of Django mysql-connector-python supports. You should file a bug against mysql-connector-python to support Django 1.8 and document which versions of Django are supported.

comment:3 by Patrick Hagemeister, 8 years ago

Disclaimer: I'm aware that this is not really a issue within the django project, the comment below is just to point others having the same issue into the right direction.


According to a MySQL bug ticket at http://bugs.mysql.com/bug.php?id=76752#c437087
it seems that a django 1.8 capable version of mysql-connector-django exists:
http://dev.mysql.com/downloads/connector/python/
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.zip

However it is unfotunately not available via pypi (see https://pypi.python.org/pypi/mysql-connector-python).

So installation works via

pip install --egg http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.zip

Unfortunately I have not found a way to retain the "--egg" parameter in a pip-requirement.txt :-/

Hope this helps.

Last edited 8 years ago by Patrick Hagemeister (previous) (diff)

comment:4 by Gerben Morsink, 8 years ago

Thanks a bunch!

Note: See TracTickets for help on using tickets.
Back to Top