1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Refs #32379 -- Changed default USE_TZ to True.

Per deprecation timeline.
This commit is contained in:
Mariusz Felisiak
2023-01-06 12:30:23 +01:00
parent e2b1478e5c
commit 0036c04a76
6 changed files with 11 additions and 44 deletions

View File

@@ -2929,11 +2929,7 @@ See also :setting:`DECIMAL_SEPARATOR`, :setting:`NUMBER_GROUPING` and
``USE_TZ``
----------
Default: ``False``
.. note::
In Django 5.0, the default value will change from ``False`` to ``True``.
Default: ``True``
A boolean that specifies if datetimes will be timezone-aware by default or not.
If this is set to ``True``, Django will use timezone-aware datetimes internally.
@@ -2944,11 +2940,9 @@ be retained if present.
See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
.. note::
.. versionchanged:: 5.0
The default :file:`settings.py` file created by
:djadmin:`django-admin startproject <startproject>` includes
``USE_TZ = True`` for convenience.
In older versions, the default value is ``False``.
.. setting:: USE_X_FORWARDED_HOST

View File

@@ -261,6 +261,9 @@ to remove usage of these features.
* The undocumented ``django.utils.datetime_safe`` module is removed.
* The default value of the ``USE_TZ`` setting is changed from ``False`` to
``True``.
See :ref:`deprecated-features-4.1` for details on these changes, including how
to remove usage of these features.

View File

@@ -24,23 +24,17 @@ or under bill your customers by one hour, twice a year, every year. The
solution to this problem is to use UTC in the code and use local time only when
interacting with end users.
Time zone support is disabled by default. To enable it, set :setting:`USE_TZ =
True <USE_TZ>` in your settings file.
Time zone support is enabled by default. To disable it, set :setting:`USE_TZ =
False <USE_TZ>` in your settings file.
.. note::
.. versionchanged:: 5.0
In Django 5.0, time zone support will be enabled by default.
In older version, time zone support was disabled by default.
Time zone support uses :mod:`zoneinfo`, which is part of the Python standard
library from Python 3.9. The ``backports.zoneinfo`` package is automatically
installed alongside Django if you are using Python 3.8.
.. note::
The default :file:`settings.py` file created by :djadmin:`django-admin
startproject <startproject>` includes :setting:`USE_TZ = True <USE_TZ>`
for convenience.
If you're wrestling with a particular problem, start with the :ref:`time zone
FAQ <time-zones-faq>`.