質問

The admin view of blog objects lists blog objects sorted by date. When the page is open (on development server), this error is returned:

Database returned an invalid value in QuerySet.dates(). Are time zone definitions and pytz installed?

The error message also includes: Server time: Tue, 3 Dec 2013 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

In settings.py: TIME_ZONE = 'America/Detroit'

On the CentOS machine in /etc/sysconfig/clock: ZONE='America/Detroit'

When I start the development server, it shows: December 03, 2013 - 17:01:23

MySQL field datatype is DATETIME and includes data like 2013-12-03 20:48:09

In admin.py I added

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?

thanks!

役に立ちましたか?

解決

Need add timezones in MySQL.
Documentation - dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top