all time in django are timezone-sensitive(AKA. offeset-aware)
so if you compare a django time with datetime.now()(offset_naive)
if will give u the error as
Can't subtract offset-naive and offset-aware datetimes
So:
The correct solution is to add the timezone info e.g., to get the current time as an aware datetime object in Python 3:
from datetime import datetime, timezone
now = datetime.now(timezone.utc)
网友评论