from flask import Flask, redirect, url_for
from flask.typing import ResponseReturnValue
import yaml

from app.extensions import db
from app.extensions import migrate
from app.extensions import bootstrap
from app.portal import portal

app = Flask(__name__)
app.config.from_file("../config.yaml", load=yaml.safe_load)
db.init_app(app)
migrate.init_app(app, db, render_as_batch=True)
bootstrap.init_app(app)

app.register_blueprint(portal, url_prefix="/portal")


@app.route('/')
def index() -> ResponseReturnValue:
    return redirect(url_for("portal.portal_home"))


if __name__ == '__main__':
    app.run()
