报错Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?解决
在django中的setting.py中:
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Shanghai' #'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
由于USE_TZ=True开启了导致错误
解决方法:
在终端输入以下代码
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
输入mysql密码即可(注意上面语句中的mysql不是密码)