1
votes

In settings there are:

TIME_ZONE = 'Europe/Rome'
USE_TZ = True
USE_L10N = True

But everything with auto_now=True in DB is stored UTC, and in admin displayed the same UTC! How to force django format datetime correctly in UI or force to store everything in naive current time? Can loacales mess it up?

UPDATE: I found that simple as posiblle django app launched with runserver handles dates correctly, while on GAE not.

2
The datetimeproperty has no concept of timezone and of you use autonow=True etc... it will always be UTC. You are better off storing everything as UTC, and adapt the display of the datetime to the TZ of the viewer. I have no idea how you would do that in django - (I don't use it) - Tim Hoffman
No, this is not the case. Django should format UTC time from DB taking TZ from settings when outputing to UI. While this works with runserver, it does not on Google app engine. - CW_Vaidotas

2 Answers

1
votes

I found that adding pytz-gae lib, (copying pytz folder to project) and importing it in settings (from pytz.gae import pytz) helps. Now time in admin UI gets formatted according to TIME_ZONE in settings.

Also removing import now yields to an error, that tz 'Europe/Rome' is not available. Before copying pytz to project, no error was thrown.

0
votes

See this link

Bottom line, App Engine does not give a flying f*** about TZ