Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ answer newbie questions, and generally made Django that much better:
Joachim Jablon <ewjoachim@gmail.com>
Joao Oliveira <joaoxsouls@gmail.com>
Joao Pedro Silva <j.pedro004@gmail.com>
jodizzle
Joe Heck <http://www.rhonabwy.com/wp/>
Joe Jackson <joe@joejackson.me>
Joel Bohman <mail@jbohman.com>
Expand Down
10 changes: 4 additions & 6 deletions django/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
import time
import warnings
from pathlib import Path
import zoneinfo

from django.conf import global_settings
from django.core.exceptions import ImproperlyConfigured
Expand Down Expand Up @@ -295,11 +295,9 @@ def __init__(self, settings_module):
)

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.
zoneinfo_root = Path("/usr/share/zoneinfo")
zone_info_file = zoneinfo_root.joinpath(*self.TIME_ZONE.split("/"))
if zoneinfo_root.exists() and not zone_info_file.exists():
try:
zoneinfo.ZoneInfo(self.TIME_ZONE)
except zoneinfo.ZoneInfoNotFoundError:
raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
# Move the time zone info into os.environ. See ticket #2315 for why
# we don't do this unconditionally (breaks Windows).
Expand Down
Loading