Reputation: 15
I'm a newbie in django. I'm providing some parsed content on a page from data, which was loaded from another web source via api. So, I'm wondering if there a way to load data one time in a day and then save it to a file, so my program will parse that data from a file for the rest of that day, not via api service? Where should I look for?
Upvotes: 1
Views: 518
Reputation: 1
You can use Django-celery to automatically execute any python function at a specific time or daily. Django-celery
Upvotes: 0
Reputation: 167
As already stated, you could just write a script and use the system cron. But since you are using django and python, you could as well go with https://django-cron.readthedocs.io/en/latest/installation.html which allows you to schedule execution of code within django.
Upvotes: 0
Reputation: 15662
You could write a cron job that runs each day and fetches the data you need then saves it to a file on your machine (or better yet, to your database). Django Cron makes this pretty easy.
Upvotes: 2