Nitz
Nitz

Reputation: 380

Django: Scheduled executeion of tasks

I'm building a Django system that needs to daily fetch data from another source (e.g. a daily dump of JSON files from a government site).
The Django site is supposed to run in Docker, currently as a single server but optionally scaling later.
I'd like to run the scheduled task internally inside Django (not using crontab or SystemD), but unsure how to do that.
The schedule isn't dynamic (I'm happy setting the cadence in the Python code), and I don't want to have to run an external command aside from runserver.

All of the solutions I found seem to necessitate running another component / command / process, and I wonder if there's a more elegant solution.

Upvotes: 0

Views: 161

Answers (1)

Tanveer
Tanveer

Reputation: 1215

  1. Celery (with celery beat) https://pypi.org/project/django-celery-beat/
  2. Django-Q https://django-q.readthedocs.io/en/latest/

just follow the documentation to implement scheduled task in Django if you find any difficulty feel free to ask me

Upvotes: 1

Related Questions