1

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
ftelnov
  • 111
  • 1
  • 8

1 Answers1

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