使用 Mysql 8.0 日期时间不兼容测试 Django

Test Django with Mysql 8.0 datetime incompatible

使用 Mysql 8.0 日期时间不兼容测试 Django。

我正在尝试 运行 使用 mysql 8.0 进行测试,但是我遇到了一些不一致的地方。有人可以帮忙吗?

Mysql 8.0.11 Django 2.0.4

> AttributeError at /admin/login/ 
>
>'datetime.datetime' object has no
> attribute 'split' 
>
>Request Method:    
>
>POST Request
> URL:  http://localhost:8000/admin/login/?next=/admin/ 
>
Django
> Version:  2.0.4 
>
>Exception Type:    AttributeError Exception Value: 
> 'datetime.datetime' object has no attribute 'split' 
>
>Exception
> Location: /usr/local/lib/python3.6/site-packages/mysql/connector/conversion.py
> in _DATETIME_to_python, line 506 Python
> 
>
>Executable:    /usr/local/bin/python Python Version:   3.6.5

MySQL Connector/Python 8.0.11 现在 returns SQL DATETIME 列类型为 Python 的 datetime.datetime。我认为以前它是 str 类型,因此 Django 对此有问题,因为将 datetime.datime 视为 str(ing).

已解决。

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME' : 'dev', 'USER' : 'root', 'PASSWORD' : 'root', 'HOST' : 'Maria1', 'OPTIONS': { 'autocommit': True, } } }