-
-
Save ask/195e4229e9d5f1ff6a3d to your computer and use it in GitHub Desktop.
Revisions
-
ask revised this gist
May 12, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def configure_celery(flask_app): class ContextTask(celery.Task): abstract = True def __call__(self, *args, **kwargs): with flask_app.app_context(): return super(ContextTask, self).__call__(*args, **kwargs) celery.Task = ContextTask celery.finalize() -
ask revised this gist
May 12, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,8 @@ def configure_celery(flask_app): class ContextTask(celery.Task): abstract = True def __call__(self, *args, **kwargs): with flaskapp.app_context(): return super(ContextTask, self).__call__(*args, **kwargs) celery.Task = ContextTask celery.finalize() -
ask revised this gist
May 12, 2014 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,28 @@ #project.async from celery import Celery celery = Celery(autofinalize=False) def configure_celery(flask_app): #...set celery up celery.config_from_object(app.config) class ContextTask(celery.Task): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask celery.finalize() #project.__init__ create_app(*kwargs): app = Flaks(__name__) db.init_app(app) configure_celery(flask_app) #project.tasks from project.async import celery -
mikeywaites revised this gist
May 12, 2014 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,15 +3,24 @@ def make_celery(app): #...set celery up global celery celery = Celery(app.import_name, broker=app.config['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 #project.__init__ create_app(*kwargs): app = Flaks(__name__) db.init_app(app) make_celery(app) #project.tasks from project.async import celery -
mikeywaites created this gist
May 12, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #project.async celery = None def make_celery(app): #...set celery up celery = _celery #project.__init__ create_app(*kwargs): app = Flaks(__name__) db.init_app(app) #project.tasks from project.async import celery @celery.task def add(x, y): x + y