Friday, November 11, 2016

Re: python3 manage.py migrate got an error

Are you, by any chance, trying to put string into DateTime field?

On 11 Nov 2016, at 15:45, Tim Graham <timograham@gmail.com> wrote:

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

On Friday, November 11, 2016 at 7:07:26 AM UTC-5, xiupei gao wrote:
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

-- 
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.

No comments:

Post a Comment