2👍
✅
Maybe less elegant, but definitely most simple, I scheduled my process for “now” with the at command. Done.
os.system("echo '/usr/bin/python /(somewhere)/scripts/backup/testbackup.py' | at now")
8👍
You need to use a completely separate process for the backup. The best way to do this is to use a message queue – the view puts the backup request on the queue, and a separate listener picks it up and runs the backup, independently of Apache.
Celery is a distributed task manager that deals with all this for you, although it would be fairly easy to roll your own with RabbitMQ and the Python AMQP library.
- [Django]-Retrieve HTTP Header in Django RestFrameWork
- [Django]-How to filter a Django QuerySet's related fields' 'all' or 'none'
Source:stackexchange.com