错误原因:
python3中已经取消了MySQLdb包
处理办法
安装pymysql包
pip install PyMySQL
以以下目录结构为例,在test5/test5/init.py中添加如下代码:
import pymysql
pymysql.install_as_MySQLdb()
├── booktest
│ ├── admin.py
│ ├── apps.py
│ ├── init.py
│ ├── migrations
│ │ ├── init.py
│ │ └── pycache
│ ├── models.py
│ ├── pycache
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── manage.py
├── static
│ └── booktest
│ └── a1.jpg -> /usr/share/wallpapers/deepin/Flying_Whale_by_Shu_Le.jpg
├── templates
│ └── index.html
└── test5
├── init.py
├── pycache
├── settings.py
├── urls.py
└── wsgi.py