Re: [python-cn:14575] [python-chinese] Django的setting.py中的TIME_ZONE设置问题

4 views
Skip to first unread message

憨狗

unread,
Sep 3, 2006, 10:10:16 PM9/3/06
to pyth...@googlegroups.com, djan...@googlegroups.com
在时间这个地方我这儿开始也有问题,我曾经调整过,也是按照上面的URL找到
的,放到settings里面,也没有彻底解决问题,现在的设置又改回去了,成了
下面这样:

# Local time zone for this installation. All choices can be found here:

#
http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE

TIME_ZONE = 'CCT'

# Language code for this installation. All choices can be found here:

# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes

# http://blogs.law.harvard.edu/tech/stories/storyReader$15

LANGUAGE_CODE = 'zh-cn'

同时因为两个主机一个在上海,一个在DH上面,上海的这台机器上面,我修改了系
统的时间设置,现在Djanog这边就正常了,

上海的主机上面的时间为:
su-2.05b# date
Mon Sep 4 10:04:37 CST 2006

而DH上面的时间为:
hackgou@runts:~$ date
Sun Sep 3 19:05:27 PDT 2006

上面两个主机一个在上海,一个在DH上面,部署的代码、设置都是一样的,但是结
果不一样,所以我想问题有可能出在系统时间这儿,
我的平台是FreeBSD 5.4,apache22+mode_python 1.3,Django版本是0.96-pre,
数据库是mysql 5.02 alpha

马踏飞燕 wrote:
> 我看其他人的代码中写的是 TIME_ZONE = 'CCT' ,可是我查了一下那个注释里面的URL,感觉正确的写法应该是 TIME_ZONE
> = 'Asia/Shanghai' 。
>
> 当我写成CCT或者任何其它的东西的时候,pub_date =
> models.DateTimeField('发布日期',auto_now_add=True)
> 这个写在数据库中的是格林尼治时间,也就是中国时间减掉8个小时。
> 我用 TIME_ZONE = 'Asia/Shanghai' 之后,写入的就对了,请问别人有遇到过这个问题吗?
>
> 我用的数据库是mysql的。
> _______________________________________________
> python-chinese
> Post: send python-...@lists.python.cn
> Subscribe: send subscribe to python-chin...@lists.python.cn
> Unsubscribe: send unsubscribe to python-chin...@lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


Reply all
Reply to author
Forward
0 new messages