<s> from celery import Celery <EOL> def create_celery_app ( app ) : <EOL> if app . config . get ( '<STR_LIT>' ) : <EOL> app . celery = Celery ( __name__ , broker = app . config [ '<STR_LIT>' ] ) <EOL> app . celery . conf . update ( app . config ) <EOL> taskbase = app . celery . Task <EOL> class ContextTask ( taskbase ) : <EOL> abstract = True <EOL> def __call__ ( self , * args , ** kwargs ) : <EOL> with app . app_context ( ) : <EOL> return taskbase . __call__ ( self , * args , ** kwargs ) <EOL> app . celery . Task = ContextTask </s>
