Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 celeryIntegration.py

View raw Download
text/x-script.python • 456 B
Python script, ASCII text executable
        
            
1
import flask
2
from celery import Celery, Task
3
4
5
def initCeleryApp(app: flask.Flask):
6
class FlaskTask(Task):
7
def __call__(self, *args: object, **kwargs: object):
8
with app.app_context():
9
return self.run(*args, **kwargs)
10
11
celeryApp = Celery(app.name, task_cls=FlaskTask)
12
celeryApp.config_from_object(app.config["CELERY"])
13
celeryApp.set_default()
14
app.extensions["celery"] = celeryApp
15
return celeryApp
16