datetime.utcnow() is not offset-aware and should be replaced with datetime.now(timezone.utc)
The problem
For some reason datetime.utcnow() is not offset-aware. This can be verified with datetime.utcnow().tzinfo is None.
datetime.utcnow() should be replaced with datetime.now(timezone.utc), which is offset-aware. This can be verified with datetime.now(timezone.utc).tzinfo is None.
Are you referring to CachedResponse.created_at and expires? Those are only created, modified, and compared internally, so they do not need to be timezone-aware; they are always assumed to be UTC. Any user- or header-provided datetimes are also converted to timezone-naive UTC. This is needed because not all storage backends have a native method to store a timezone offset.
Is there a specific problem you've encountered with this?