Code source de geonature.celery_app

from .app import create_app
from .utils.celery import celery_app as app
from .utils.module import iter_modules_dist


[docs] flask_app = create_app()
[docs] class ContextTask(app.Task):
[docs] def __call__(self, *args, **kwargs): with flask_app.app_context(): return self.run(*args, **kwargs)
app.Task = ContextTask app.conf.imports += ("geonature.tasks",) app.conf.imports += tuple( [ep.module for dist in iter_modules_dist() for ep in dist.entry_points.select(name="tasks")] )