即使经过数小时和数小时的谷歌搜索,也无法找到答案.搜索堆栈溢出.我向你们保证,我已经看到了所有可能被视为相关的答案,但这些答案都没有解决我所面临的问题.无需再费周折 –
目前在shell中我可以这样做:
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
验证我已安装此模块.但是,当我尝试转到settings.py文件以设置DATABASE ENGINE时
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'mydb',
'USER': 'root',
'PASSWORD': 'test123',
'HOST': '127.0.0.1',
'PORT': '3306'
}
}
并尝试启动我的服务器我一直收到错误:
django.core.exceptions.ImproperlyConfigured: 'mysql.connector.django'
isn't an available database backend.
不知道如何解决这个问题.我在Django版本1.9.7上,Python版本显示在上面的代码片段中
使用’mysql.connector.django’与使用’django.db.backends.mysql’之间有什么区别?