setup_app.py 348 Bytes
Newer Older
Nicolas Joyard committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# -*- coding: utf-8 -*-

from flask import Flask


def setup_app(name):
    # Create app
    app = Flask(name)

    # Load config
    app.config.from_object('parlapi.config.CurrentConfig')

    # Setup DB
    from .models import db
    db.init_app(app)

    # Setup routes
    from .routes import setup_routes
    setup_routes(app)

    return app