运行Windows下创建的Django项目时,发生此错误! Database returned an invalid value in QuerySet.dates(). Are time zone definitions and pytz installed?
按提示先安装pytz
1、先安装easy_install:
sudo apt-get install python-setuptools
2、进入官网,获取下载地址,使用wget命令下载:
wget https://pypi.python.org/packages/2.7/p/pytz/pytz-2014.4-py2.7.egg#md5=1e394a3b24ef6a5848c46bed82810915
3、安装:
sudo easy_install pytz-2014.4-py2.7.egg
安装完毕,不行,于是查找官方文档:点击打开链接 一头雾水,仔细看提示,似乎是数据库的原因,查看文档:点击打开链接
运行以下命令,重启,搞定:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
备注:The
mysql_tzinfo_to_sql program loads the time zone tables in the
mysql
database. It is used on systems that have a
zoneinfo database (the set of files describing time zones). Examples of such systems are Linux, FreeBSD, Solaris, and Mac OS X. One likely location for these files is the
/usr/share/zoneinfo
directory (/usr/share/lib/zoneinfo
on Solaris). If your system does not have a zoneinfo database, you can use the downloadable package described in
Section 10.6, “MySQL Server Time Zone Support”.
本文由@The_Third_Wave(Blog地址:http://blog.csdn.net/zhanh1218)原创。还有未涉及的,会不定期更新,有错误请指正。
如果你看到这篇博文时发现没有不完整,那是我为防止爬虫先发布一半的原因,请看原作者Blog。
如果这篇博文对您有帮助,为了好的网络环境,不建议转载,建议收藏!如果您一定要转载,请带上后缀和本文地址。
Django Ubuntu:Database returned an invalid value in QuerySet.dates(). 错误的解决方法,布布扣,bubuko.com
Django Ubuntu:Database returned an invalid value in QuerySet.dates(). 错误的解决方法