title: Flask Celery No result backend configured
body: <p>I'm trying to use celery 3.1.17 with flask but i'm stuck with a "No result backend configured" error. 
  I'm new to both flask and celery so probably i'm doing something wrong.
  If i use <a href="https://github.com/thrisp/flask-celery-example/blob/master/settings.py" rel="nofollow">this</a> code everything goes fine, but as i split the code into different files i get that error. I'm missing something but what?
  I'm using Flask-Script to run the app with "manage.py runserver", files structure is:</p>
  
  <pre><code>.
  ├── app
  │   ├── core.py
  │   ├── extensions.py
  │   └── __init__.py
  ├── manage.py
  └── settings.py
  </code></pre>
  
  <p>With settings.py - just settings</p>
  
  <pre><code># -*- coding: utf-8 -*-
  DEBUG = True
  SECRET_KEY = 'not_a_secret'
  CELERY_BROKER_URL = 'amqp://'
  CELERY_RESULT_BACKEND = 'amqp'
  </code></pre>
  
  <p>manage.py - runs the applicationn</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import absolute_import
  import os
  from app import create_app
  from flask.ext.script import Manager, Shell, Server
  
  app = create_app()
  manager = Manager(app)
  manager.add_command("runserver", Server(host="0.0.0.0", port=5032))
  
  
  def make_shell_context():
      return dict(app=app)
  manager.add_command('shell', Shell(make_context=make_shell_context))
  
  if __name__ == '__main__':
      manager.run()
  </code></pre>
  
  <p>app/<strong>init</strong>.py: creates app and make_celery as <a href="http://flask.pocoo.org/docs/0.10/patterns/celery/" rel="nofollow">docs</a> say</p>
  
  <pre><code>from __future__ import absolute_import
  from flask import Flask
  from .extensions import celery, make_celery
  import settings
  
  
  def create_app():
      app = Flask(__name__)
      app.config.from_object(settings)
      make_celery(app, celery)
  
      from .core import core as core_blueprint
      app.register_blueprint(core_blueprint)
  
      return app
  </code></pre>
  
  <p>app/extensions.py: instantiates celery and define simple task</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import absolute_import
  from celery import Celery
  
  
  def make_celery(app, celery):
      celery = Celery(app.import_name, backend=app.config['CELERY_RESULT_BACKEND'], 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
      print 'passo da make_celery'
      return celery
  
  
  celery = Celery()
  
  @celery.task(name="tasks.add")
  def add(x, y):
      return x + y
  </code></pre>
  
  <p>app/core.py defines two routes: one for run the task and one for get the result</p>
  
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import absolute_import
  from flask import Flask, Blueprint, abort, jsonify, request, session
  from app.extensions import add
  
  core = Blueprint('core', __name__)
  
  @core.route("/test")
  def hello_world(x=16, y=16):
      x = int(request.args.get("x", x))
      y = int(request.args.get("y", y))
      res = add.apply_async((x, y))
      context = {"id": res.task_id, "x": x, "y": y}
      result = "add((x){}, (y){})".format(context['x'], context['y'])
      goto = "{}".format(context['id'])
      return jsonify(result=result, goto=goto)
  
  
  @core.route("/test/result/&lt;task_id&gt;")
  def show_result(task_id):
      retval = add.AsyncResult(task_id).get(timeout=1.0)
      return repr(retval)
  </code></pre>
  
  <p>After launching <code>celery -A app.extensions.celery worker -l debug</code> I can go to /test but then if I try to go to /test/result/ i get the following error:</p>
  
  <pre><code>  File "/virt/biscelery/lib/python2.7/site-packages/celery/result.py", line 169, in get
      no_ack=no_ack,
    File "/virt/biscelery/lib/python2.7/site-packages/celery/backends/base.py", line 597, in _is_disabled
      'No result backend configured.  '
  NotImplementedError: No result backend configured.  Please see the documentation for more information.
  </code></pre>
  
  <p>Why celery loose the backend configuration?
  If i modify in celery/backends/<strong>init</strong>.py the get_backend_cls function from</p>
  
  <pre><code>def get_backend_cls(backend=None, loader=None):
      """Get backend class by name/alias"""
      backend = backend or 'disabled'
      loader = loader or current_app.loader
      aliases = dict(BACKEND_ALIASES, **loader.override_backends)
      try:
          return symbol_by_name(backend, aliases)
      except ValueError as exc:
          reraise(ValueError, ValueError(UNKNOWN_BACKEND.format(
              backend, exc)), sys.exc_info()[2])
  </code></pre>
  
  <p>to</p>
  
  <pre><code>def get_backend_cls(backend=None, loader=None):
      """Get backend class by name/alias"""
      backend = backend or 'amqp'
      loader = loader or current_app.loader
      aliases = dict(BACKEND_ALIASES, **loader.override_backends)
      try:
          return symbol_by_name(backend, aliases)
      except ValueError as exc:
          reraise(ValueError, ValueError(UNKNOWN_BACKEND.format(
              backend, exc)), sys.exc_info()[2])
  </code></pre>
  
  <p>Everything start working again. I can't figure out what i'm doing wrong.
  Any help really appreciated. </p>