Example #1
0
File: eapp.py Project: Inkvi/ella
def create_app():
    app = Flask(__name__)
    with open('/etc/ella/settings.yml') as f:
        app.config.update(**yaml.load(f))

    ELLIPTICS_HOSTNAME = app.config.get('ELLIPTICS_HOSTNAME')

    if ELLIPTICS_HOSTNAME:
        app.node = init_elliptics(ELLIPTICS_HOSTNAME)
    else:
        app.before_request(before)

    app.add_url_rule('/', 'home', view_func=views.home, methods=['GET', 'POST'])
    app.add_url_rule('/routing', view_func=views.routing)
    app.add_url_rule('/stats', view_func=views.stats)
    app.add_url_rule('/find', view_func=views.find)
    app.add_url_rule('/download/<string:key>', view_func=views.download)
    return app
Example #2
0
    log.info("Pyro4 configured.")
    app.node = Node.create_node(conf)
    if app.node.is_master_node():
        app.scheduler = Scheduler(app.node, app.scheduled_jobs)
        app.scheduler.start()
    log.info("Started.")
    app.run(host='0.0.0.0', port=conf.port)


logging.basicConfig(level=logging.INFO)

log = logging.getLogger('PARCS')

app = Flask(__name__)
app.debug = False
app.node = None
app.scheduler = None
app.scheduled_jobs = Queue()


def bad_request():
    return Response(status=400)


def not_found():
    return Response(status=404)


def ok():
    return Response(status=200)