10 lines
330 B
Python
10 lines
330 B
Python
def init_celery(celery, app):
|
|
celery.conf.update(app.config) # Load all configurations form Flask app including Queue settings
|
|
|
|
class ContextTask(celery.Task):
|
|
def __call__(self, *args, **kwargs):
|
|
with app.app_context():
|
|
return self.run(*args, **kwargs)
|
|
|
|
celery.Task = ContextTask
|