Running an arbitrary Django task along with "runserver" forever
For a Django-based server I require the simultaneous running of scripts in a fashion similar to cronjobs. I want to avoid the explicit usage of cronjobs and instead, integrate these periodic tasks to the HTTP server initialization - that is, when I run either
manage.py runserver or a very similar management command, alongside the HTTP daemon, two other processes start that can perform my tasks periodically.
I already created management commands for these scripts. What are my options?
My best guess is starting two threads either in
AppConfig.ready() like suggested here or somehow in
manage.py itself. I'm not entirely sure if it has any caveats, though.
Since asking this question, I realized my only solution is the initialization of threads and also that I should do it explicitly in either
wsgi.py, depending on my production solution - runserver management command is not suitbale for production.