text: from flask import Flask
  from flask.ext.sqlalchemy import SQLAlchemy
  from flask.ext.login import LoginManager
  from celery import Celery
  
  print "Opening a Refinery"
  
  app = Flask(__name__)
  app.config.from_object('config')
  db = SQLAlchemy(app)
  
  lm = LoginManager()
  lm.init_app(app)
  lm.login_view = 'login'
  
  def make_celery(app):
      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
      return celery
  
  app.config.update(
      CELERY_BROKER_URL='redis://localhost:6379',
      CELERY_RESULT_BACKEND='redis://localhost:6379',
      CELERY_IMPORTS=['refinery.webapp.topicmodel','refinery.webapp.main_menu'],
      CELERY_REDIS_MAX_CONNECTIONS=4
  )
  
  celery = make_celery(app)
  