The admin view of blog objects lists blog objects sorted by date. When the page is open (on development server), this error is returned:
blog对象的管理视图列出按日期排序的blog对象。当页面打开(在开发服务器上)时,返回此错误:
Database returned an invalid value in QuerySet.dates(). Are time zone definitions and pytz installed?
数据库在QuerySet.dates()中返回无效值。是否安装了时区定义和pytz ?
The error message also includes: Server time: Tue, 3 Dec 2013 16:58:33 -0500
错误消息还包括:服务器时间:Tue, 2013年12月3日16:58:33 -0500
pip install pytz
returns: Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/lib/python2.6/site-packages/pytz-2013.8-py2.6.egg
pip安装pytz返回:已经满足的需求(使用——升级到升级):pytz in /usr/lib/python2.6/site-packages/pytz-2013.8-py2.6.egg
In settings.py: TIME_ZONE = 'America/Detroit'
在设置。py:TIME_ZONE =美国/底特律的
On the CentOS machine in /etc/sysconfig/clock: ZONE='America/Detroit'
在CentOS机器上/etc/sysconfig/clock: ZONE='America/Detroit'
When I start the development server, it shows: December 03, 2013 - 17:01:23
当我启动开发服务器时,它显示:2013年12月03日- 17:01:23
MySQL field datatype is DATETIME
and includes data like 2013-12-03 20:48:09
MySQL字段数据类型是DATETIME,包括2013-12-03 20:48:09这样的数据
In admin.py I added
在管理。py我添加了
import pytz
from pytz import *
but it doesn't change anything.
但它不会改变任何东西。
Not sure what else to check--all the above looks correct. Why would django complain about pytz?
不确定还要检查什么——上面所有的看起来都是正确的。为什么django要抱怨pytz?
thanks!
谢谢!
1 个解决方案
#1
1
Need add timezones in MySQL.
Documentation - dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html
需要在MySQL中添加时区。文档——dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html
#1
1
Need add timezones in MySQL.
Documentation - dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html
需要在MySQL中添加时区。文档——dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html