def init_celery(app, celery):
celery.conf.update(app.config)<EOL>TaskBase = celery.Task<EOL>class ContextTask(TaskBase):<EOL><INDENT>abstract = True<EOL>def __call__(self, *args, **kwargs):<EOL><INDENT>with app.app_context():<EOL><INDENT>return TaskBase.__call__(self, *args, **kwargs)<EOL><DEDENT><DEDENT><DEDENT>celery.Task = ContextTask<EOL>return celery<EOL>
Initialise Celery and set up logging

:param app: Flask app
:param celery: Celery instance