问题描述
在创建计划任务时,我同时使用了Cron和为django专门设置的守护程序。
In creating scheduled tasks I've used both Cron and a specially set up daemon for django.
Cron很简单,而守护程序(在我看来)可能过多。守护程序设置了一个独立的Django实例。
Cron is silly-simple, and the daemon (in my opinion) might be excessive. The daemon set up an independent Django instance.
Django本身(如果我没记错的话)还是作为守护程序运行的,对吗?
Django itself (If I'm not mistaken) runs as a daemon anyway, correct?
我想知道-您如何在Django环境中安排任务而又不偏离标准用法?
I'm wondering - how do you schedule tasks within the Django environment without leaving off from standard use?
推荐答案
您可以使用来运行,但是根据您要执行的操作,这可能会过大。
You can use Celery to run periodic tasks but depending on what are you trying to do it could be overkill.
如果您的用例很简单,那么使用cron + management命令可以更轻松。您可以使用,或为此
If your use case it's simple, cron+management command it's way easier. You can use Kronos, django-cron or any of this libraries for this
这篇关于Django计划的任务-Cron或Independent守护程序的替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!