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.
Asked
Active
Viewed 159 times
1
-
this should help solve your problem https://stackoverflow.com/a/33788049/11891228 – Godda Mar 14 '20 at 12:19
-
Have you done any research? – AMC Mar 14 '20 at 17:38
1 Answers
1
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

jabez
- 896
- 1
- 9
- 22