summaryrefslogtreecommitdiff
path: root/django/conf/__init__.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2021-05-14 15:58:45 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-05-18 20:26:44 +0200
commit8cd55021bcb6c9727c1adccd9623fa4acfc0312b (patch)
tree6a5a411a0c07bf88e8c550bb94e4ee9f148ccb26 /django/conf/__init__.py
parent958cdf65ae90d26236d1815bbba804729595ec7a (diff)
Fixed #32379 -- Started deprecation toward changing default USE_TZ to True.
Co-authored-by: Nick Pope <nick@nickpope.me.uk> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'django/conf/__init__.py')
-rw-r--r--django/conf/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 00b2ab82d0..628b1f7e4d 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -9,10 +9,12 @@ for a list of all possible variables.
import importlib
import os
import time
+import warnings
from pathlib import Path
from django.conf import global_settings
from django.core.exceptions import ImproperlyConfigured
+from django.utils.deprecation import RemovedInDjango50Warning
from django.utils.functional import LazyObject, empty
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
@@ -157,6 +159,14 @@ class Settings:
setattr(self, setting, setting_value)
self._explicit_settings.add(setting)
+ if self.USE_TZ is False and not self.is_overridden('USE_TZ'):
+ warnings.warn(
+ 'The default value of USE_TZ will change from False to True '
+ 'in Django 5.0. Set USE_TZ to False in your project settings '
+ 'if you want to keep the current default behavior.',
+ category=RemovedInDjango50Warning,
+ )
+
if hasattr(time, 'tzset') and self.TIME_ZONE:
# When we can, attempt to validate the timezone. If we can't find
# this file, no check happens and it's harmless.