MRed
MRed

Reputation: 15

django save data once in a day to file after first script run

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

Answers (3)

mada badr eddine
mada badr eddine

Reputation: 1

You can use Django-celery to automatically execute any python function at a specific time or daily. Django-celery

Upvotes: 0

jnvilo
jnvilo

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

Henry Woody
Henry Woody

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

Related Questions