celery,logger,limiter,cache,logo

This commit is contained in:
resonate
2022-01-24 11:58:28 +08:00
parent a3c61d3291
commit 2e6067fd31
15 changed files with 127 additions and 27 deletions
+18
View File
@@ -0,0 +1,18 @@
from celery import Celery
from entrance.config import celery as config
from entrance.config.celery import broker_url
celery = Celery(__name__, broker=broker_url)
def register_celery(app):
celery.config_from_object(config)
class ContextTask(celery.Task):
def __call__(self, *args, **kwargs):
with app.app_context():
return self.run(*args, **kwargs)
celery.Task = ContextTask