Actually the problem is very common. Let me describe this by example.Imagine you have a web service where users register and pay for some gold status. There is expiration date. The question is how to remove the gold status in time?I see at least two solutions: Write a daemon that checks user statuses and current time and perform some actionsUse cron as a deamon and do the sameBut I believe there are other approaches. By the way the language the system is written is Python but I don't think this really matters.
How to perform deferred tasks in backend
design;architecture;python
Assuming you're using a database to store account information, filtering a search on account_expiry>=get_date() on the database (i.e. in SQL) is a negligible operation.If you're not using a database for account information, your approach would vary based on what you're using.To answer your titled question, how do you run a deferred task on a backend in python, look at Celery