From: Olivier Tétard Date: Thu, 12 Nov 2015 17:04:55 +0000 (+0100) Subject: Ajout de la liste des fichiers up sur la home X-Git-Url: http://olivier.miskin.fr/git/?a=commitdiff_plain;h=61e3a2fe873e6fa63150fe8f532849143b95951e;p=femtoblackweb.git Ajout de la liste des fichiers up sur la home --- 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 %}