import script + config from od2m app
parent
0b90c608a6
commit
1bedc10e6a
@ -0,0 +1,21 @@
|
|||||||
|
import typing as t
|
||||||
|
|
||||||
|
import werkzeug
|
||||||
|
from flask import render_template
|
||||||
|
|
||||||
|
from .app import app
|
||||||
|
from .cmd import db_cli
|
||||||
|
from .routes import main
|
||||||
|
|
||||||
|
app.register_blueprint(main)
|
||||||
|
app.cli.add_command(db_cli)
|
||||||
|
|
||||||
|
|
||||||
|
@app.errorhandler(404)
|
||||||
|
def page_not_found(e: werkzeug.exceptions.HTTPException) -> t.Tuple[t.Text, int]:
|
||||||
|
return render_template("404.html", title="Page non trouvée"), 404
|
||||||
|
|
||||||
|
|
||||||
|
@app.errorhandler(500)
|
||||||
|
def internal_server_error(e: werkzeug.exceptions.HTTPException) -> t.Tuple[t.Text, int]:
|
||||||
|
return render_template("500.html", title="Erreur interne du serveur"), 500
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
from .db import db_cli
|
||||||
|
|
||||||
|
__all__ = ["db_cli"]
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
from .data import Institution, State, Production_place, Diplo_type, Document, Acte, Individual, Duke, Produced_by
|
||||||
|
|
||||||
|
__all__ = ["Institution", "State", "Production_place", "Diplo_type", "Document", "Acte", "Individual", "Duke", "Produced_by"]
|
||||||
@ -1,42 +1,58 @@
|
|||||||
#!/usr/bin/python
|
import os
|
||||||
# -*- coding: UTF-8 -*-
|
import re
|
||||||
|
import typing as t
|
||||||
|
|
||||||
|
import peewee
|
||||||
|
from flask import Blueprint, abort, render_template, request, send_from_directory
|
||||||
|
from playhouse.flask_utils import PaginatedQuery
|
||||||
|
|
||||||
"""
|
from .app import APPPATH
|
||||||
author : Jean-Damien Généro
|
from .modeles import Institution, State, Production_place, Diplo_type, Document, Acte, Individual, Duke, Produced_by
|
||||||
date : 2022-10-01
|
|
||||||
update :
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
RESULT_PAR_PAGES = 5
|
||||||
|
|
||||||
# import des librairie
|
main = Blueprint("main", __name__, url_prefix="/")
|
||||||
from flask import Flask, render_template, request
|
|
||||||
from .app import app
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@main.route("/")
|
||||||
def home():
|
def home():
|
||||||
"""home route"""
|
"""home route"""
|
||||||
return render_template("home.html")
|
return render_template("home.html")
|
||||||
|
|
||||||
@app.route("/about/")
|
@main.route("/about/")
|
||||||
def about():
|
def about():
|
||||||
"""home route"""
|
"""home route"""
|
||||||
return render_template("about.html")
|
return render_template("about.html")
|
||||||
|
|
||||||
@app.route("/actes/")
|
@main.route("/actes/")
|
||||||
def corpora_all():
|
def corpora_all():
|
||||||
"""copora all route"""
|
"""copora all route"""
|
||||||
return render_template("corpora_all.html")
|
return render_template("corpora_all.html")
|
||||||
|
|
||||||
@app.route("/actes/<house>") # dont put a slash at the end
|
@main.route("/actes/<house>") # dont put a slash at the end
|
||||||
def actes(house):
|
def actes(house):
|
||||||
"""actes route"""
|
"""actes route"""
|
||||||
return render_template("corpus.html", house=house)
|
return render_template("corpus.html", house=house)
|
||||||
|
|
||||||
@app.route("/actes/<house>/<prince>") # dont put a slash at the end
|
@main.route("/actes/<house>/<prince>") # dont put a slash at the end
|
||||||
def prince_corpus(house=None, prince=None):
|
def prince_corpus(house=None, prince=None):
|
||||||
"""copora prince route"""
|
"""copora prince route"""
|
||||||
return render_template("prince_corpus.html", house=house, prince=prince)
|
return render_template("prince_corpus.html", house=house, prince=prince)
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/contact")
|
||||||
|
def contact() -> t.Text:
|
||||||
|
"""Displays the Contact page"""
|
||||||
|
return render_template("contact.html", title="Contact")
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/termsofservice")
|
||||||
|
def terms() -> t.Text:
|
||||||
|
"""Displaysthe T&C page."""
|
||||||
|
return render_template("terms.html", title="Mentions légales")
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/privacy")
|
||||||
|
def privacy() -> t.Text:
|
||||||
|
"""Displays the privacy policy page."""
|
||||||
|
return render_template("privacy.html", title="Politique de confidentialité")
|
||||||
|
|||||||
Loading…
Reference in New Issue