Code

Opened 3 years ago

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

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by romain

  • Cc romain added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 3 years ago by ptone

  • Resolution set to worksforme
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.