本文介绍了安排常规事件:Cron / Cron替代品(包括Celery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是定期运行一些特定的动作。很明显,这是的任务,对吧?

Something I've had interest in is regularly running a certain set of actions at regular time intervals. Obviously, this is a task for cron, right?

不幸的是,互联网似乎在那里有点不一致。

Unfortunately, the Internet seems to be in a bit of disagreement there.

让我详细介绍一下我的设置。首先,我的开发环境在Windows中,而我的生产环境托管在(Linux )。 Windows上没有真正的cron,对吧?此外,我使用! Django有什么建议?

Let me elaborate a little about my setup. First, my development environment is in Windows, while my production environment is hosted on Webfaction (Linux). There is no real cron on Windows, right? Also, I use Django! And what's suggested for Django?

当然!不幸的是,设置Celery对于我来说已经或多或少是一个字面上的噩梦 - 请参阅 。这只是我与芹菜有关的一个问题。其他的包括一个套接字错误,我是唯一一个有问题的人。

Celery of course! Unfortunately, setting up Celery has been more or less a literal nightmare for me - please see Error message 'No handlers could be found for logger "multiprocessing"' using Celery. And this is only ONE of the problems I've had with Celery. Others include a socket error which it I'm the only one ever to have gotten the problem.

不要误会我,芹菜似乎真的很酷。不幸的是,似乎缺乏支持,并且其首选后端中存在一些奇怪的限制,执行异步或计划任务。

A simple, non-Celery way to approach things would be to create Django custom management commands to perform your asynchronous or scheduled tasks.

然后,在Windows上,您可以使用 / code>命令来安排这些任务。在Linux上,您使用 cron

Then, on Windows, you use the at command to schedule these tasks. On Linux, you use cron.

如果可以用于开发环境,我也强烈建议您将Windows 。在Linux或甚至Mac OSX上,你的生活会更好一些。重新使用Ubuntu的备用或旧机器,或在Windows机箱的虚拟机中运行Ubuntu。

I'd also strongly recommend ditching Windows if you can for a development environment. Your life will be so much better on Linux or even Mac OSX. Re-purpose a spare or old machine with Ubuntu for example, or run Ubuntu in a VM on your Windows box.

这篇关于安排常规事件:Cron / Cron替代品(包括Celery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:15