[英]python3 manage.py migrate got an error
I just started a new project and change database engine 我刚开始一个新项目并更改数据库引擎
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'mysite',
'USER': 'root',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '3306',
}
} then after running python3 manage.py migrate i got an error: 然后在运行python3 manage.py migration之后,我得到了一个错误:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/mysql/connector/django/base.py", line 177, in _execute_wrapper
return method(query, args)
File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 515, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 434, in _handle_result
self._handle_noresultset(result)
File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 404, in _handle_noresultset
self._warnings[0][1], self._warnings[0][2])
mysql.connector.errors.DatabaseError: 1265: Data truncated for column 'applied' at row 1
You have to: 你必须:
python3 manage.py makemigrations
And then: 接着:
python3 manage.py migrate
Then you can safely start the server again 然后,您可以安全地重新启动服务器
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.