django 报错:No module named 'MySQLdb'

当你运行django时报如下错误:

'Did you install mysqlclient or MySQL-python?' % e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?
 

原因:在项目的__init__文件下缺少如下命令:

import pymysql

pymysql.install_as_MySQLdb()

猜你喜欢

转载自blog.csdn.net/chen1042246612/article/details/84061530