from flask import Flask


from .config import config_by_name
from .controllers.controller import api
from .models import db


def create_app(config_name):
    app = Flask(__name__)
    app.config.from_object(config_by_name[config_name])
    db.init_app(app)
    api.init_app(app)

    return app
