mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 20:46:23 +03:00
not working mess
This commit is contained in:
18
backend/textsouls/common/celery.py
Normal file
18
backend/textsouls/common/celery.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from celery import Celery
|
||||
|
||||
|
||||
def make_celery(app):
|
||||
celery = Celery(
|
||||
app.import_name,
|
||||
backend=app.config["CELERY_RESULT_BACKEND"],
|
||||
broker=app.config["CELERY_BROKER_URL"],
|
||||
)
|
||||
celery.conf.update(app.config)
|
||||
|
||||
class ContextTask(celery.Task):
|
||||
def __call__(self, *args, **kwargs):
|
||||
with app.app_context():
|
||||
return self.run(*args, **kwargs)
|
||||
|
||||
celery.Task = ContextTask
|
||||
return celery
|
||||
Reference in New Issue
Block a user