首页 > 代码库 > Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your datab

Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your datab

Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?

这种问题一般出现在时差配置的问题上

首先错误信息提示是否定义你数据库的时区,是否安装pytz

网络上有说是因为mysql时区的问题,但是修改了貌似作用不大


最后发现是project中settings.py中的配置问题,修正

USE_TZ = False

LANGUAGE_CODE = ‘zh-cn‘

TIME_ZONE = ‘Asia/Chongqing‘