简体   繁体   中英

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. 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.

Is there a provision in django-celery to do this?

Thanks.

Celery have special configuration settings named: CELERY_IMPORTS . Its a list with files named which need to be imported and checked for existing Celery task functions. So, i think django-celery just add there something like */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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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