Running python manage.py truncate_request_token_log --max-days=90 raises an exception:
Truncating request token log records:
-> Retaining last 90 days' request token log records
Traceback (most recent call last):
File "manage.py", line 30, in <module>
main()
File "manage.py", line 26, in main
execute_from_command_line(sys.argv)
File ".venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File ".venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File ".venv/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File ".venv/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File ".venv/lib/python3.9/site-packages/request_token/management/commands/truncate_request_token_log.py", line 69, in handle
timestamp = max(t1, t2)
TypeError: can't compare offset-naive and offset-aware datetimes
The same behaviour if using the max-count argument.
Running
python manage.py truncate_request_token_log --max-days=90
raises an exception:The same behaviour if using the
max-count
argument.Python 3.9.4 + Django 3.2.16 (with
USE_TZ = True
) + MySQL 8.0.31