GAE 时区问题解决办法
分类-Google App Engine
十月 15, 2009 19:15
1331 Views 4 Comments
即使在settings.py 中设置了 TIME_ZONE 发现GAE 用的还是 UTC 时间。
可能是因为 GAE 的model 是和 Django 分离的有关。。
只能自己写个函数在提交文章和评论的时候修改为当前时间,而不用 auto_now_add
def _cntime():
return datetime.datetime.utcnow() + datetime.timedelta(hours=+8)
def add_archive():archive.pub_date = _cntime()
COMMENTS | 评论