I have a Django model called DataLog that stores API action logs. I need to delete this automatically after every 60 days

What is the best practice in Django to achieve this? Should I use a management command + cron job, django-crontab, or Celery beat for scheduling the deletion? Is there a way to make this automatic without having to call the cleanup manually inside my views?

I tried using crontab by creating a function to delete the data after 60 days from created_at.

Вернуться на верх