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).

Also when I try to install it directly via

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

It fails because the installation process tries to use a new option in setuptools which my local version doesn't have:

Collecting http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.zip
  Downloading http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.zip (356kB)
    100% |████████████████████████████████| 356kB 7.8MB/s
Installing collected packages: mysql-connector-python
  Found existing installation: mysql-connector-python 2.0.4
    Uninstalling mysql-connector-python-2.0.4:
      Successfully uninstalled mysql-connector-python-2.0.4
  Running setup.py install for mysql-connector-python
    Complete output from command /Users/patrick/.virtualenvs/ib-cms/bin/python -c "import setuptools, tokenize;__file__='/var/folders/s0/t3yxc5c16m32qzmwrsbtdybm0000gn/T/pip-0EgqCn-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/s0/t3yxc5c16m32qzmwrsbtdybm0000gn/T/pip-5uIg95-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/patrick/.virtualenvs/ib-cms/include/site/python2.7/mysql-connector-python:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --single-version-externally-managed not recognized

I have stopped investigating this at this point because I'm unwilling to update setuptools/python because that would invole quite a bit of overhead in the environment I'm working on.

Hope this helps.

Version 0, edited 8 years ago by Patrick Hagemeister (next)

comment:4 by Gerben Morsink, 8 years ago

Thanks a bunch!

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