can't compare offset-naive and offset-aware datetimes - last_seen option [duplicate] can't compare offset-naive and offset-aware datetimes - last_seen option [duplicate] flask flask

can't compare offset-naive and offset-aware datetimes - last_seen option [duplicate]


Create an aware datetime (a datetime which has a timezone):

import pytzself.last_seen = datetime.datetime.utcnow().replace(tzinfo=pytz.UTC)

In this case you'll want to create an aware datetime with the current time in UTC.

You'll need the pytz package for this (this package contains the latest timezone information and that information isn't part of the Python standard library).