def make_celery(app: Flask) -> Celery:
    celery = Celery(app.import_name,
                    backend=app.config.get('CELERY_BACKEND'),
                    broker=app.config.get('CELERY_BROKER_URL'))
    celery.conf.update(app.config)
    TaskBase = celery.Task

    class ContextTask(TaskBase):
        abstract = True

        def __call__(self, *args, **kwargs):
            with app.app_context():
                return TaskBase.__call__(self, *args, **kwargs)

    celery.Task = ContextTask

    # Attach plugins
    plugins, manager = find_odsc_plugins()
    celery.ODSC_PLUGINS = plugins
    celery.ODSC_PLUGINS_MANAGER = manager

    app.config["CELERY"] = celery

    return celery