use django-background-tasks to run some heavy tasks in the background in my Django application. On my local machine everything works fine. However, if I deploy my application in production with Apache and mod_wsgi, the scheduled tasks are not executed. Instead, if I run the command
python manage.py process_tasks
Executing the above command will cause the Apache server to stop working and must be restarted.
In the apache error file I found:
[Sat Aug 14 04:53:43.420851 2021] [wsgi:warn] [pid 5573] self.sig_manager = SignalMana ger()
[Sat Aug 14 04:53:43.420855 2021] [wsgi:warn] [pid 5573] File "/home/ubuntu/.virtualenvs /dj/lib/python3.9/site-packages/background_task/utils.py", line 20, in init
[Sat Aug 14 04:53:43.420859 2021] [wsgi:warn] [pid 5573] signal.signal(signal.SIGTSTP, self.exit_gracefully)
[Sat Aug 14 04:53:43.420874 2021] [wsgi:warn] [pid 5573] mod_wsgi (pid=5573): Callback reg istration for signal 10 ignored.
[Sat Aug 14 04:53:43.420963 2021] [wsgi:warn] [pid 5573] File "/home/ubuntu/web_myboot/d jango_boot/core/wsgi.py", line 18, in
[Sat Aug 14 04:53:43.420971 2021] [wsgi:warn] [pid 5573] management.call_command('proc ess_tasks')
[Sat Aug 14 04:53:43.420977 2021] [wsgi:warn] [pid 5573] File "/home/ubuntu/.virtualenvs /dj/lib/python3.9/site-packages/django/core/management/init.py", line 181, in call_com mand [Sat Aug 14 04:53:43.420981 2021] [wsgi:warn] [pid 5573] return command.execute(*args, **defaults)
[Sat Aug 14 04:53:43.420985 2021] [wsgi:warn] [pid 5573] File "/home/ubuntu/.virtualenvs /dj/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
[Sat Aug 14 04:53:43.420989 2021] [wsgi:warn] [pid 5573] output = self.handle(*args, * *options)
[Sat Aug 14 04:53:43.420993 2021] [wsgi:warn] [pid 5573] File "/home/ubuntu/.virtualenvs /dj/lib/python3.9/site-packages/background_task/management/commands/process_tasks.py", lin e 116, in handle