I'm more or less using the setup to run Celery tasks using your flask app context from here: http://flask.pocoo.org/docs/0.10/patterns/celery/
I'm getting the same error message as Create, manage and kill background tasks in flask app
but, I'm getting it in the actual worker where the Celery task is being executed. Here is the trace:
worker_1 | Traceback (most recent call last):
worker_1 | File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
worker_1 | R = retval = fun(*args, **kwargs)
worker_1 | File "/code/app/__init__.py", line 42, in __call__
worker_1 | return TaskBase.__call__(self, *args, **kwargs)
worker_1 | File "/usr/local/lib/python2.7/dist-packages/flask/ctx.py", line 186, in __exit__
worker_1 | self.pop(exc_value)
worker_1 | File "/usr/local/lib/python2.7/dist-packages/flask/ctx.py", line 178, in pop
worker_1 | % (rv, self)
worker_1 | AssertionError: Popped wrong app context. (<flask.ctx.AppContext object at 0x47a5790> instead of <flask.ctx.AppContext object at 0x427e390>)
Anyone have any ideas? Running in the app context should be fixing this problem, not creating it!
Thanks