0

Lets say I have a database model in Django which stores top 100 songs. This data comes from an api.

The problem is that the song ranking may change from time to time [30 minutes/ 1 hour].

I wish to implement a method in the web app such that it automatically runs a particular function in python [ which updates the database by sending api requests] every 10 minutes , whether there is a user online or not.

How can I do this?

2 Answers2

1

You can use Celery for this, but it is probably overkill if you just have simple task. http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html

Domen Blenkuš
  • 2,182
  • 1
  • 21
  • 29
0

A simple solution would be to create a django management task wich update the song raking and call it with a cron every ten minutes.

related answere : django scheduled job

Community
  • 1
  • 1