From ae48dbc97896fa23c50b98adcb9a375ed20e20ac Mon Sep 17 00:00:00 2001 From: cuiweizhi <560397@gree.com.cn> Date: Sun, 12 Nov 2023 11:04:16 +0800 Subject: [PATCH] Update project --- application/__init__.py | 1 - application/utils/__init__.py | 1 - application/utils/celery/__init__.py | 13 ----------- application/utils/celery/celery.py | 35 ---------------------------- 4 files changed, 50 deletions(-) delete mode 100644 application/utils/celery/__init__.py delete mode 100644 application/utils/celery/celery.py diff --git a/application/__init__.py b/application/__init__.py index ac528a7..5730cd2 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -17,7 +17,6 @@ from flask import Flask from application.extensions import init_plugs from application.views import init_views from application.script import init_script -from application.utils import make_celery from application.common import global_config as gc diff --git a/application/utils/__init__.py b/application/utils/__init__.py index 1f76f47..6838d43 100644 --- a/application/utils/__init__.py +++ b/application/utils/__init__.py @@ -12,4 +12,3 @@ from .dsn import DatabaseUri, RedisUri from .elasticsearch import ElasticsearchUtil -from .celery import make_celery diff --git a/application/utils/celery/__init__.py b/application/utils/celery/__init__.py deleted file mode 100644 index daba8b6..0000000 --- a/application/utils/celery/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -# @Version : Python 3.11.4 -# @Software : Sublime Text 4 -# @Author : StudentCWZ -# @Email : StudentCWZ@outlook.com -# @Date : 2023/11/7 17:15 -# @File : __init__.py.py -# @Description : -""" - -from .celery import make_celery diff --git a/application/utils/celery/celery.py b/application/utils/celery/celery.py deleted file mode 100644 index 22ee2c5..0000000 --- a/application/utils/celery/celery.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -# @Version : Python 3.11.4 -# @Software : Sublime Text 4 -# @Author : StudentCWZ -# @Email : StudentCWZ@outlook.com -# @Date : 2023/11/7 17:15 -# @File : celery.py -# @Description : -""" - -from celery import Celery, Task -from flask import Flask - - -def make_celery(app: Flask): - celery = Celery( - app.import_name, - backend='redis://localhost:6379/13', - broker='redis://localhost:6379/13' - ) - celery.conf.update(app.config) - - class ContextTask(celery.Task): - def __call__(self, *args, **kwargs): - with app.app_context(): - return self.run(*args, **kwargs) - - celery.conf.update({ - 'task_cls': ContextTask, - }) - - return celery - -- GitLab