celery_app.py 446 B

1234567891011121314151617181920
  1. """
  2. Celery配置文件
  3. """
  4. from celery import Celery
  5. from app.config import Config
  6. # 创建Celery实例
  7. celery = Celery('app',
  8. broker=Config.CELERY_BROKER_URL,
  9. backend=Config.CELERY_RESULT_BACKEND,
  10. include=['app.tasks'])
  11. # Celery配置
  12. celery.conf.update(
  13. task_serializer='json',
  14. accept_content=['json'],
  15. result_serializer='json',
  16. timezone='Asia/Shanghai',
  17. enable_utc=True,
  18. )