Celery + Django 最佳实践

Celery + Django best practice

我一直在阅读这些帖子 (here and here) 中的 celerydjango,并且 celery.py 中的所有 logic/tasks 作品,但在官方文档中,它们分为两个文件:celery.pytasks.py。那么哪个是最佳实践?这会影响性能吗?

任务的位置应该不会对性能产生任何明显的影响。建议使用单独的 tasks.py 是为了更好地组织。

来自the Celery docs

Note that this example project layout [a separate tasks.py for each app] is suitable for larger projects, for simple projects you may use a single contained module that defines both the app and tasks, like in the First Steps with Celery tutorial.