简体   繁体   English

Django计划的任务-Cron或Independent守护程序的替代方案

[英]Django scheduled Tasks - Alternative to Cron or Independent Daemon

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. Cron很简单,守护程序(在我看来)可能过多。 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? 我想知道-您如何在Django环境中安排任务而不偏离标准用法?

You can use Celery to run periodic tasks but depending on what are you trying to do it could be overkill. 您可以使用Celery来执行定期任务,但是根据您要执行的操作,这可能会过大。

If your use case it's simple, cron+management command it's way easier. 如果您的用例很简单,那么使用cron + management命令可以更轻松。 You can use Kronos , django-cron or any of this libraries for this 您可以为此使用Kronosdjango-cron任何此类库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM