python3 manage.py migrate出错了

时间:2016-10-24 03:35:34

标签: python django

我刚开始一个新项目并更改了数据库引擎

DATABASES = {
'default': {
    'ENGINE': 'mysql.connector.django',
    'NAME': 'mysite',
    'USER': 'root',
    'PASSWORD': 'mypassword',
    'HOST': '127.0.0.1',
    'PORT': '3306',
}

} 然后运行python3 manage.py migrate后出现错误:

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

1 个答案:

答案 0 :(得分:0)

你必须:

python3 manage.py makemigrations 

然后:

python3 manage.py migrate

然后您可以安全地再次启动服务器

希望这有帮助