首页 > 代码库 > 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‘

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