diff --git a/app/app.py b/app/app.py index 26f198f..4d6f3b9 100644 --- a/app/app.py +++ b/app/app.py @@ -5,6 +5,8 @@ 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") @@ -27,9 +29,5 @@ def page_not_found(e: werkzeug.exceptions.HTTPException) -> t.Tuple[t.Text, int] def internal_server_error(e: werkzeug.exceptions.HTTPException) -> t.Tuple[t.Text, int]: return render_template("500.html", title="Erreur interne du serveur"), 500 +app.register_blueprint(main) -### DEBUG -@app.route('/') -@app.route('/index') -def hello_world(): - return "
Hello, World!
" diff --git a/app/routes.py b/app/routes.py new file mode 100644 index 0000000..1d276eb --- /dev/null +++ b/app/routes.py @@ -0,0 +1,56 @@ +import typing as t + +from flask import Blueprint, abort, render_template, request, send_from_directory + +main = Blueprint("main", __name__, url_prefix="/") + +@main.route("/") +def home(): + """home route""" + return render_template("home.html") + + +@main.route("/about/") +def about(): + """home route""" + return render_template("about.html") + + +@main.route("/actes/") +def corpora_all(): + """copora all route""" + return "hello" +# info = [(t.date, t.filename, t.analysis, t.prod_place_acte, +# t.diplo_type_acte, t.state_doc) for t in Acte.select()] +# prince_acte = [] +# return render_template("corpora_all.html") + + +@main.route("/actes/