[英]How can I place my Django/Celery periodic tasks and regular tasks in separate files?
All my celery tasks are contained under a tasks.py
under each Django app of mine. 我的所有芹菜任务都包含在我的每个Django应用程序下的
tasks.py
下。 It's quite cluttered. 它很混乱。
I'd like to move my celery periodic tasks into a check.py
file under each app maainly to make it easier to organise and manage my code. 我想将我的芹菜周期性任务移动到每个app下的
check.py
文件中,以便更轻松地组织和管理我的代码。
Is there a provision in django-celery to do this? django-芹菜中是否有规定这样做?
Thanks. 谢谢。
Celery have special configuration settings named: CELERY_IMPORTS
. Celery具有名为
CELERY_IMPORTS
特殊配置设置。 Its a list with files named which need to be imported and checked for existing Celery task functions. 它是一个包含已命名文件的列表,需要为现有的Celery任务函数导入和检查。 So, i think django-celery just add there something like
*/tasks.py
. 所以,我认为django-celery只是添加
*/tasks.py
。 In your way you can add somethings in footer of your manage.py script in put in CELERY_IMPORTS
scripts what you want to use. 在您的方式中,您可以在您要使用的
CELERY_IMPORTS
脚本中添加manage.py脚本页脚中的CELERY_IMPORTS
内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.