Commit ae48dbc9 authored by 崔为之's avatar 崔为之 💪🏽

Update project

parent 47258f4c
...@@ -17,7 +17,6 @@ from flask import Flask ...@@ -17,7 +17,6 @@ from flask import Flask
from application.extensions import init_plugs from application.extensions import init_plugs
from application.views import init_views from application.views import init_views
from application.script import init_script from application.script import init_script
from application.utils import make_celery
from application.common import global_config as gc from application.common import global_config as gc
......
...@@ -12,4 +12,3 @@ ...@@ -12,4 +12,3 @@
from .dsn import DatabaseUri, RedisUri from .dsn import DatabaseUri, RedisUri
from .elasticsearch import ElasticsearchUtil from .elasticsearch import ElasticsearchUtil
from .celery import make_celery
#!/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
#!/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment