Reputation: 121
I need my Django app processing some functions in background periodically. What is the best way for making such functions? And how can I call some functions when server starts? For example, functions of pre-init.
Upvotes: 1
Views: 181
Reputation: 906
For periodical jobs, you can try Django RQ Scheduler.
As for running functions at runtime, you can place the code in any models.py file or in apps.py like following
from django.apps import AppConfig
class FooConfig(AppConfig):
name = 'foo'
def ready(self):
# import here and do logic
Upvotes: 1