djangoscheduling

How do i setup scheduling task on Django?


I've create a reporting module using Django for a project i have. Essentially what it does it has a list of reports where you can select a start date and end for the reports and run it. Then the report view runs a cursor query and fetches results. All of this works.

But now i want to implement a queuing feature. Where you set a start date and end date then set a date time for the report to be automatically run (Which will be stored in a database) and keep the result. The user then can come back anytime to revisit the report without it being rerun

What is the best way to achieve this?

Thanks

I've tried to use a cron job which run daily to check for reports and run them to achieve this but this fails to fulfill time scheduling


Solution

  • For your usage i think the best option is to use celery tasks. There is a django package named django-celery-beat.

    You can find the documentation here:

    https://django-celery-beat.readthedocs.io/en/latest/