Hi
I am confused about the timezone setting. I have my OS timezone set to 'Asia/Shanghai', and my MYSQL/Mariadb is also using 'Asia/Shanghai' timezone. So i tried to configure the timezone in DJANGO settings.py
TIME_ZONE = 'Asia/Shanghai'
And then i aware that after setting this, the time used in the models.py auto_now=True seems to be incorrect. but when i use datetime.datetime.now() the time should be correct, so i use the manage.py shell to check.
Below is the checking result
>>> timezone.get_current_timezone()
<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
datetime.datetime(2018, 1, 18, 10, 11, 0, 936572, tzinfo=<UTC>)
>>> datetime.datetime.now()
datetime.datetime(2018, 1, 18, 18, 20, 23, 722825)
Seems that the timezone.get_current_timezone has returned the right "Asia/Shanghai' timezone, but when i run timezone.now(), it is using UTC time, and when i use datetime.datetime.now(), it is using the correct time.
So it is quite weird behavoir. Can someone tell me if this is a bug or i had missed out some setting?
Louis