task.py 487 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter web
  4. name:site.py
  5. author:rabin
  6. """
  7. import datetime
  8. t = datetime.datetime(2017,12,21)
  9. if type(t) == datetime.datetime:
  10. print 1
  11. print 2
  12. """
  13. from demeter.core import *
  14. from celery import Celery,platforms
  15. platforms.C_FORCE_ROOT = True
  16. app = Celery('task', backend='redis://0.0.0.0:6379/0', broker='redis://0.0.0.0:6379/0') #配置好celery的backend和broker
  17. @app.task #普通函数装饰为 celery task
  18. def add(x, y):
  19. return x + y
  20. """