From aa7e37ddfe1257e50db218da0683623c6ceb911f Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Thu, 2 Dec 2021 19:05:44 +0100 Subject: [PATCH] Base de serveur --- app.py | 9 +++++++++ definitions.py | 8 ++++++++ pages.py | 4 ++++ templates/main.html | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 app.py create mode 100644 definitions.py create mode 100644 pages.py create mode 100644 templates/main.html diff --git a/app.py b/app.py new file mode 100644 index 0000000..29c0713 --- /dev/null +++ b/app.py @@ -0,0 +1,9 @@ +# Fichier principal +from flask import Flask, escape, request +import pages + +app = Flask(__name__) + +@app.route('/') +def main(): + return pages.main() diff --git a/definitions.py b/definitions.py new file mode 100644 index 0000000..893429a --- /dev/null +++ b/definitions.py @@ -0,0 +1,8 @@ +### Fonctions communes + +def read(path): + # Retourne le contenu texte d'un fichier + f = open(path,'r') + result = f.read() + f.close() + return result diff --git a/pages.py b/pages.py new file mode 100644 index 0000000..767097e --- /dev/null +++ b/pages.py @@ -0,0 +1,4 @@ +import definitions as lib + +def main(): + return lib.read("templates/main.html") diff --git a/templates/main.html b/templates/main.html new file mode 100644 index 0000000..9188e32 --- /dev/null +++ b/templates/main.html @@ -0,0 +1,3 @@ +

Bienvenue !

+ +

Ceci est la page d'accueil !