MySQL Connector / Python as a Django Engine?

You cannot find the answer for this even after hours and hours of searching on Google and. I assure you, I saw all the answers that can be considered relevant, and none of them solved the problem that I encountered. Without further ado -

Currently in the shell I can do this:

Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information. 
>>> from distutils.sysconfig import get_python_lib
>>> print get_python_lib()
/usr/lib/python2.7/dist-packages
>>> import mysql.connector
>>> db = mysql.connector.connect(user='root', password='test123', host='127.0.0.1', database='mydb')
>>> db
<mysql.connector.connection.MySQLConnection object at 0x7fd3a80536d0>

verify that I have this module installed. However, when I try to go to the settings.py file to set the DATABASE DATE

DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        'NAME': 'mydb',
        'USER': 'root',
        'PASSWORD': 'test123',
        'HOST': '127.0.0.1',
        'PORT': '3306'
    }
}

and try to start my server, I keep getting an error:

django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django'
isn't an available database backend.

I don’t know how to fix it. I'm on Django version 1.9.7, the Python version is shown in the code snippet above

What is the difference between using "mysql.connector.django" and using "django.db.backends.mysql"?

+4
1

'mysql.connector.django' 'django.db.backends.mysql'?

- , - . , 1.1.x, django , django.

MySQL DB API Drivers

API Python Database PEP 249. MySQL , API:

MySQLdb - , . mysqlclient - MySQLdb, Python 3 MySQLdb. , MySQL Django. MySQL Connector/Python - Python Oracle, MySQL Python . - . MySQLdb Python 3 .

API DB, Django ORM. Django MySQLdb/mysqlclient, MySQL Connector/Python .

+1

All Articles