From 61e3a2fe873e6fa63150fe8f532849143b95951e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20T=C3=A9tard?= Date: Thu, 12 Nov 2015 18:04:55 +0100 Subject: [PATCH] Ajout de la liste des fichiers up sur la home --- femtoblackweb.py | 5 +++-- templates/index.html | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/femtoblackweb.py b/femtoblackweb.py index 8c0b2bd..e185881 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from flask import Flask, request, redirect, url_for, render_template, jsonify, abort, send_from_directory, session -import os +import os, pathlib from werkzeug import secure_filename @@ -38,7 +38,8 @@ def page_not_found(e): @app.route('/') def index(): - return render_template('index.html') + files = [p.name for p in pathlib.Path(app.config['UPLOAD_FOLDER']).iterdir() if p.is_file()] + return render_template('index.html', files=files) @app.route('/upload', methods=['GET', 'POST']) def upload_file(): diff --git a/templates/index.html b/templates/index.html index 065efbe..6db6b45 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,4 +7,10 @@ + + {% endblock %} -- 2.30.2