在测试template时,使用
now = datetime.datetime.now()
发现显示的时间不对
然后通过
date
查看发现系统的时间是没有问题的
那么肯定是时区设置问题了
进入setting.py中设置
#TIME_ZONE = 'UTC'#默认
#修改为
TIME_ZONE = 'Asia/Shanghai'
之后查看就显示正常了
在测试template时,使用
now = datetime.datetime.now()
发现显示的时间不对
然后通过
date
查看发现系统的时间是没有问题的
那么肯定是时区设置问题了
进入setting.py中设置
#TIME_ZONE = 'UTC'#默认
#修改为
TIME_ZONE = 'Asia/Shanghai'
之后查看就显示正常了
转载于:https://my.oschina.net/draguo/blog/520045