python3 manage.py migrate got an error

78 views
Skip to first unread message

xiupei gao

unread,
Nov 11, 2016, 7:07:26 AM11/11/16
to Django users
i just started a new project and changed the default database engine by

DATABASES = {
    'default': {
       
'ENGINE': 'mysql.connector.django',
        'NAME': 'django',
        'USER': 'root',
        'PASSWORD': 'mypassword',
        'HOST': '127.0.0.1',
    }
}
then i ran python3 manage.py migrate,error occured
Operations to perform:
 
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
 
Applying admin.0002_logentry_remove_auto_add...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/connection.py", line 490, in cmd_query
    result
= self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
 
File "/usr/local/lib/python3.5/site-packages/mysql/connector/connection.py", line 395, in _handle_result
   
raise errors.get_exception(packet)
mysql
.connector.errors.DataError: 1292 (22007): Incorrect datetime value: '2016-11-11 05:16:15.696428+00:00' for column 'action_time' at row 1

Tim Graham

unread,
Nov 11, 2016, 7:45:17 AM11/11/16
to Django users
The only thing that comes to mind is that mysql.connector may not support the latest version of Django.

Try mysqlclient if that's an option for you. https://docs.djangoproject.com/en/stable/ref/databases/#mysql-db-api-drivers

GMail

unread,
Nov 11, 2016, 7:52:58 AM11/11/16
to django...@googlegroups.com
Are you, by any chance, trying to put string into DateTime field?

-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e8aa17c8-5a46-4b8c-a1e2-b6eb3bd5e85e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages