[Django] #30643: USE_TZ is enabled by default

18 views
Skip to first unread message

Django

unread,
Jul 16, 2019, 2:55:51 PM7/16/19
to django-...@googlegroups.com
#30643: USE_TZ is enabled by default
------------------------------------------------+------------------------
Reporter: terminator14 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
In
[https://github.com/django/django/blob/master/docs/topics/i18n/timezones.txt
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".

--
Ticket URL: <https://code.djangoproject.com/ticket/30643>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 16, 2019, 3:26:06 PM7/16/19
to django-...@googlegroups.com
#30643: Docs incorrectly state that time zone support is disabled by default.
-------------------------------+--------------------------------------
Reporter: terminator14 | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => duplicate
* version: 2.2 => master
* easy: 1 => 0
* type: Cleanup/optimization => Bug


Comment:

Duplicate of #28362.

--
Ticket URL: <https://code.djangoproject.com/ticket/30643#comment:1>

Django

unread,
Jul 16, 2019, 4:26:44 PM7/16/19
to django-...@googlegroups.com
#30643: Docs incorrectly state that time zone support is disabled by default.
-------------------------------+--------------------------------------
Reporter: terminator14 | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by terminator14):

* status: closed => new
* resolution: duplicate =>


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/30643#comment:2>

Django

unread,
Jul 16, 2019, 6:54:20 PM7/16/19
to django-...@googlegroups.com
#30643: Docs incorrectly state that time zone support is disabled by default.
-------------------------------+--------------------------------------
Reporter: terminator14 | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by terminator14):

Replying to [comment:2 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,
[https://docs.djangoproject.com/en/2.2/topics/settings/ here].
Still, the timezone article has no mention of it, which is still confusing
for anyone not already familiar with the concept.

--
Ticket URL: <https://code.djangoproject.com/ticket/30643#comment:3>

Django

unread,
Jul 17, 2019, 12:45:57 AM7/17/19
to django-...@googlegroups.com
#30643: Docs incorrectly state that time zone support is disabled by default.
-------------------------------+--------------------------------------
Reporter: terminator14 | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => duplicate


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/30643#comment:4>

Django

unread,
Jul 17, 2019, 11:10:11 AM7/17/19
to django-...@googlegroups.com
#30643: Docs incorrectly state that time zone support is disabled by default.
-------------------------------+--------------------------------------
Reporter: terminator14 | Owner: nobody

Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by terminator14):

> 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.
If I'm alone on this, that's fine, but it really was confusing when I
first read it.

--
Ticket URL: <https://code.djangoproject.com/ticket/30643#comment:5>

Reply all
Reply to author
Forward
0 new messages