import typing as t
import os

from flask import Flask
from flask import render_template
#import werkzeug

from .routes import main

APPPATH = os.path.dirname(os.path.abspath(__file__))
templates = os.path.join(APPPATH, "templates")
static = os.path.join(APPPATH, "static")

app = Flask(
    "Princely-Acts",
    template_folder=templates,
    static_folder=static,
    static_url_path=''
)


@app.errorhandler(404)
def page_not_found(e):
    return render_template("404.html", title="Page non trouvée"), 404


@app.errorhandler(500)
def internal_server_error(e):
    return render_template("500.html", title="Erreur interne du serveur"), 500

app.register_blueprint(main)

