ImportError: No module named ‘MySQLdb'

1.APP未注册

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crm', #这里未注册会报错:ImportError: No module named ‘MySQLdb'
]

2.对应项目下:__init__.py

import pymysql

pymysql.install_as_MySQLdb()
上一篇:解决 ImportError: No module named 'pip._internal'问题


下一篇:MVC新手指南