1、安装mysql-python
pip install mysql-python
ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20
2、修改配置文件settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': 'localhost',
'PORT': 3306,
'NAME': 'osdb',
'USERNAME': 'root',
'PASSWORD': 'root',
}
}
参考博文:
http://www.cnblogs.com/havenshen/p/3531489.html
https://shenxgan.gitbooks.io/django/content/publish/2015-07-13-django-mysql.html
本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/1961424,如需转载请自行联系原作者