【发布时间】:2016-11-18 15:53:43
【问题描述】:
我正在寻找在我的 Django 1.10 Web 项目中使用的选项,我需要每小时运行一些任务。我知道我可以使用 DJCELERY,但它没有针对 Django 1.10 进行更新,并且我收到了这些错误,
Error fetching command 'celerymon': type object 'BaseCommand' has no attribute 'option_list'
Command 'celerymon' skipped
Error fetching command 'celerybeat': type object 'BaseCommand' has no attribute 'option_list'
Command 'celerybeat' skipped
Error fetching command 'celeryd_multi': type object 'BaseCommand' has no attribute 'option_list'
Command 'celeryd_multi' skipped
Error fetching command 'celeryd': type object 'BaseCommand' has no attribute 'option_list'
Command 'celeryd' skipped
Error fetching command 'celerycam': type object 'BaseCommand' has no attribute 'option_list'
Command 'celerycam' skipped
Error fetching command 'celery': type object 'BaseCommand' has no attribute 'option_list'
Command 'celery' skipped
Error fetching command 'celeryd_detach': type object 'BaseCommand' has no attribute 'option_list'
Command 'celeryd_detach' skipped
Error fetching command 'djcelerymon': type object 'BaseCommand' has no attribute 'option_list'
Command 'djcelerymon' skipped
那么还有其他选项可以用来在后台运行任务吗? django 在新版本中是否提供类似的功能?
谢谢。
【问题讨论】:
-
如果
celery不是您的选择,请使用cronjob。 -
django 的 cronjob?
-
不,linux cronjob。您可以创建一个执行您想要的操作的 python 脚本并将其放入 cronjob。另一种选择是降级您的 django。我相信早期的 django 版本也应该有你需要的几乎所有东西。
-
我无法降级。我在我公司的项目正在运行的 Windows 服务器上使用相同的东西。我们正在将它迁移到 Linux 服务器,所以我想知道其他选项。我想我会做同样的事情,任务的 python 脚本。
-
django-cronjob 可以帮助设置 cronjobs 顺便说一句
标签: python django asynchronous djcelery