开发者

Django application using UTC throughout

开发者 https://www.devze.com 2023-04-04 20:33 出处:网络
I am building a Django application that will be using UTC for all time stamps and datetime fields. The users (operators of a networks of environmental research stations) are trained to enter times in

I am building a Django application that will be using UTC for all time stamps and datetime fields. The users (operators of a networks of environmental research stations) are trained to enter times in UTC (GMT) and the server as well as the users' work desktop/laptop computers are set to UTC with no daylight saving time adjustment.

In settings.py, I could set TIME_ZONE to None, but do not want to rely on server time if I can help it.

How would you set D开发者_StackOverflow社区jango's configuration settings?


I could be wrong on this (I've only partially updated a project to correctly handle timezones), but I believe that the TIME_ZONE variable is only used by the Postgres backend (determined by grepping the source). So, if you're not using Postgres, it doesn't really matter what you use… And if you are using Postgres, you can use "UTC" (relevant documentation).


See https://docs.djangoproject.com/en/dev/ref/settings/#time-zone

It's called "UCT Etc/UCT" in the Django docs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号