Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#17733 closed Cleanup/optimization (fixed)

Default timezone settings are different from the operating systems'

Reported by: berdario Owned by: aaugustin
Component: Documentation Version: 1.4-alpha-1
Severity: Normal Keywords: timezone
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


The template reads:

"On Unix systems, a value of None will cause Django to use the same timezone as the operating system."

but by leaving the TIME_ZONE off, it will use the TIME_ZONE defined in the global_settings... compared to explicitly overriding it with None: that instead will indeed use a django.utils.timezone.LocalTimezone instance

this is quite unexpected

moreover: the django.utils.timezone code warns that in case of problems, you'd be better off with pytz than by trying to use LocalTimezone

so, using None to automatically detect the system timezone as suggested, will prevent django from using pytz, even if it was installed

I don't know if it's fine to suggest that None could be used without warning about that, but in case I think it would be better to

  • change the value in django/conf/ to None


  • change the comments inside django/conf/project_template/project_name/

Attachments (1)

17733.patch (1.6 KB) - added by aaugustin 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to aaugustin
  • Patch needs improvement unset

comment:2 Changed 4 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

None would be a more neutral value that 'America/Chicago' for TIME_ZONE, but changing that would be backwards incompatible -- the default dates back to before None was made a legal value. Also, it's one of these small bits of history that are part of Django's character... (granted, that's very subjective).

I think it's best to keep the comment short in the template and elaborate the various possibilities in the docs. I'm attaching a patch along these lines. I you think it addresses your concerns, could you change the "Triage Stage" to "Ready for Checkin"?

comment:3 Changed 4 years ago by aaugustin

  • Component changed from Uncategorized to Documentation
  • Has patch set

Changed 4 years ago by aaugustin

comment:4 Changed 4 years ago by ramiro

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 4 years ago by aaugustin

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

In [17809]:

Fixed #17733 -- Discouraged setting TIME_ZONE to None when USE_TZ is True. Thanks berdario for the report.

comment:6 Changed 4 years ago by claudep

In [17818]:

(The changeset message doesn't reference this ticket)

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