Answer the question
In order to leave comments, you need to log in
Why and how does Django affect time.localtime?
I noticed that Django (apparently through the TIME_ZONE setting) affects the work of the built-in time.localtime function.
I thought that this function relies on the OS time zone, but dzhanga somehow influences it. How does this happen? and why?
Answer the question
In order to leave comments, you need to log in
Yes, django affects time.localtime() via os.environ['TZ'] and time.tzset() if USE_TZ=True is set. And unlike my assumption that django settings only affect django itself (django.utils.timezone.local()), it turned out that in the end ALL aware datetime.datetime created in such an environment will use the TIMEZONE slipped by django. Oh, those global variables.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question