根据Django : RunTimeWarning : DateTimeField received a naive datetime while time zone support is active,使用
获取带有时区信息的今天的日期from django.utils import timezone
today = timezone.now()
当我这样做时:
from datetime import timedelta
yesterday = today - timedelta(days=1)
但现在yesterday
不再是时区感知了。如何在进行日期和时间算术时保持时区意识?