Timezone changes on development server after first request
|Reported by:||antti.a.laine@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When using development server, the time returned by datetime, time and other modules is in different timezone after the first request has been served.
TIME_ZONE = 'Europe/Helsinki'
from datetime import datetime now = datetime.now() utc = datetime.utcnow() return HttpResponse("now = %s\nutc = %s\n" % (now, utc))
At the time of writing in this gives:
now = 2011-09-29 11:55:15.651728 utc = 2011-09-29 08:55:15.651732
...when the request is done after starting the development server, and
now = 2011-09-29 08:55:16.631865 utc = 2011-09-29 08:55:16.631903
...after making the request the second time.
It does not matter which request is first handled; the timezone gets changed when any request gets run after starting the development server. This bug is not present when running on a production server (Google App Engine in this case).