報錯:
django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED' at line 1")
原因:
mysql服務器版本問題
解決:
settings.py--->DATABASES添加 'OPTIONS': {'isolation_level': None} ,如下:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'stockplus_db',
'USER': 'root',
'HOST': 'localhost',
'POST': 3306,
'PASSWORD': 'root',
'OPTIONS': {'isolation_level': None}
}
}