Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30643 closed Bug (duplicate)

Docs incorrectly state that time zone support is disabled by default.

Reported by: terminator14 Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In timezones.txt, it says:

Time zone support is disabled by default. To enable it, set :setting:`USE_TZ =
True <USE_TZ>` in your settings file. 

and immediately after that, it says:

The default :file:`settings.py` file created by :djadmin:`django-admin
    startproject <startproject>` includes :setting:`USE_TZ = True <USE_TZ>`
    for convenience.

which implies it's enabled by default.
This is either wrong, or confusing.

I just tested django 2.2.3, and the default settings.py does indeed say "USE_TZ = True".

Change History (5)

comment:1 by Mariusz Felisiak, 5 years ago

Easy pickings: unset
Resolution: duplicate
Status: newclosed
Summary: USE_TZ is enabled by defaultDocs incorrectly state that time zone support is disabled by default.
Type: Cleanup/optimizationBug
Version: 2.2master

Duplicate of #28362.

comment:2 by terminator14, 5 years ago

Resolution: duplicate
Status: closednew

From the comment by Tim Graham in the duplicate ticket (#28362), I now see the confusion.
Django has a file with default settings at django/conf/global_settings.py, and settings.py just overwrites those.
USE_TZ just happens to be one setting that is set as False in global_settings.py, but True in the generated settings.py.

This is unclear in the documentation, as there is no mention of global_settings.py, or this concept. Without mention of global_settings.py, the note in the documentation about the time zone support being disabled by default just leads to confusion. I would suggest that either:

  • The note about the timezone support being disabled by default be removed, as technically, timezone support for any project is enabled by default, despite the fact that it's set to False in global_settings.py; OR
  • The concept of global_settings.py be mentioned, to clarify what it means when the documentation says that USE_TZ is "disabled by default", while being enabled in settings.py

I've been reading through all the Topics in the past few days, and I haven't seen any mention of global_settings.py, or the idea that settings.py is overwriting a global file. It was very interesting when I read Tim Graham's comment. It's possible I missed it, but if not, it might be a good idea to mention it somewhere in the Topics.

in reply to:  2 comment:3 by terminator14, 5 years ago

Replying to terminator14:

I've been reading through all the Topics in the past few days, and I haven't seen any mention of global_settings.py, or the idea that settings.py is overwriting a global file. It was very interesting when I read Tim Graham's comment. It's possible I missed it, but if not, it might be a good idea to mention it somewhere in the Topics.

I just noticed that it's mentioned in a later topic, here.
Still, the timezone article has no mention of it, which is still confusing for anyone not already familiar with the concept.

comment:4 by Mariusz Felisiak, 5 years ago

Resolution: duplicate
Status: newclosed

This ticket is still a duplicate, please don't reopen it. If you want to add some comment you can add them to the original ticket. Nevertheless I don't see any confusion here

Time zone support is disabled by default.

Means that if you don't provide USE_TZ setting then time zone support is disabled. There is also a paragraph that clarifies that:

The default settings.py file created by django-admin startproject includes USE_TZ = True for convenience.

I agree with Tim's decision to mark ticket #28362 as invalid.

comment:5 by terminator14, 5 years ago

The default settings.py file created by django-admin startproject includes USE_TZ = True for convenience.

This statement doesn't clarify anything unless you already know that the default settings.py isn't a standalone file, but is overriding settings in global_settings.py.
When I read it without knowing about global_settings.py, it didn't clarify anything. I was confused enough to start this ticket, and I'm guessing others will be too.
I was under the impression that the settings.py file decides what's enabled and disabled by default, and without that USE_TZ setting in it, django would just throw an exception.
Reading that it's disabled by default, while clearly seeing that settings.py had it enabled by default, was confusing, since that was the only place I was aware that it could be enabled and disabled.
If I'm alone on this, that's fine, but it really was confusing when I first read it.

Means that if you don't provide USE_TZ setting then time zone support is disabled.

I feel like if you have to explain it to me here, the documentation didn't adequately explain it in the first place.

Last edited 5 years ago by terminator14 (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top