django 2.2报mysql 1366

错误打印 File "/data/mysites/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 312, in _query db.query(q) File "/data/mysites/venv/lib/python3.7/site-packages/MySQLdb/connections.py", line 224, in query _mysql.connection.query(self, query) django.db.utils.OperationalError: (1366, '') 原因及修正 原因是因为mysql 5.7默认不允许字符为空,此时需要解除严格模式,在数据库配置文件中添加如下配置即可: sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
阅读全文