![](/img/trans.png)
[英]How to perform a specific task in django automatically after a fixed interval of time?
[英]How can i run my python model automatically after specific time interval?
Hey everyone hope you all are fine.... I want to ask something from you, recently I build my model (Random Forest) in python machine learning and I got my predictions and make a web app in django that shows predicted values in front结尾。 现在我想部署我的 web 应用程序,并希望在特定时间间隔后,我的数据会自动从 api 下载,类似于数据训练文件和数据预测文件。 每个任务都应该在特定时间间隔后自动运行,因为现在每次我分别运行程序以进行数据下载、数据训练和对数据进行预测时,我希望所有这些任务都应该在特定时间间隔后自动运行我将如何完成这项任务.... ?
假设服务器不在 Docker 或 Windows 上,请使用django-crontab 。
我建议将数据作业设置为管理命令,然后使用 crontab 在所需的时间间隔或一天中的时间触发它们。
设置.py
CRONJOBS = [
('0 4 * * *', 'django.core.management.call_command', ['download_the_data']),
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.