Opened 13 years ago

Closed 13 years ago

#16957 closed Bug (worksforme)

Timezone changes on development server after first request

Reported by: antti.a.laine@… Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords:
Cc: romain Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using development server, the time returned by datetime, time and other modules is in different timezone after the first request has been served.

settings.py:

TIME_ZONE = 'Europe/Helsinki'

Example view:

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).

Change History (2)

comment:1 by romain, 13 years ago

Cc: romain added

I can't reproduce this bug

  • Django 1.3.1
  • Python 2.6.5
  • Dev server running on Linux 2.6.32
  • System clock set to UTC+2 (Europe/Paris)

tested with a minimal project (no models) and the submitted view code.

comment:2 by Preston Holmes, 13 years ago

Resolution: worksforme
Status: newclosed

Sorry I'm also unable to reproduce on trunk - perhaps you can submit a complete minimal project that you think demonstrates to problem

Note: See TracTickets for help on using tickets.
Back to Top