# -*- 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
@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():
<ul>
<li><a href="{{ url_for('upload_file') }}">Analyser un nouveau fichier</a></li>
</ul>
+
+ <ul>
+ {% for fic in files %}
+ <li><a href="{{ url_for('analyze_file', filename=fic) }}">{{ fic }}</a></li>
+ {% endfor %}
+ </ul>
{% endblock %}