1

How do you schedule updating the contents of a database table in Django based on time of day. For example every 5 minutes Django will call a REST api to update contents of a table.

MezzanineLearner
  • 279
  • 1
  • 4
  • 12

2 Answers2

1

I think this is likely best accomplished by writing a server-side python script and adding a cronjob

Rampant
  • 148
  • 5
1

Based upon your question, I am not 100% clear what you are looking for. But, assuming you are looking to run some sort of a task every 5 minutes (that will make calls to the DB), then I highly suggest you look at Celery.

It is a robust task schedules, with specific Django integration. Once you get thru the getting started documentation, what you want to look at in particular is called CELERYBEAT_SCHEDULE. This allows you to sort of setup cron like calls.

This has a lot of benefits over cron, and for most use cases I find it to be a better alternative. Scalability is a huge feature for me.

Good luck!

Community
  • 1
  • 1
Adam Hopkins
  • 6,837
  • 6
  • 32
  • 52