From e18d112e54e2690a1943cd31e5cf8fe4f2a60486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Delacotte?= Date: Wed, 7 May 2025 13:24:00 +0200 Subject: [PATCH] Ajout liste des fichiers results --- .gitignore | 3 +- Dockerfile | 4 +- README.md | 10 +++ README.txt | 14 ---- src/app.py | 13 +++- src/env/env.dev | 2 + src/{templates => static}/js/echarts.js | 0 .../js/echarts_simple.js | 0 src/templates/index.html | 66 ++++++++++++++++--- 9 files changed, 84 insertions(+), 28 deletions(-) delete mode 100644 README.txt create mode 100644 src/env/env.dev rename src/{templates => static}/js/echarts.js (100%) rename src/{templates => static}/js/echarts_simple.js (100%) diff --git a/.gitignore b/.gitignore index f074ccf..cd5ad93 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ .idea .log .project -.settings \ No newline at end of file +.settings +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bfcb34e..b5c8e5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,6 @@ COPY . /src # Exposer le port 5000 pour accéder à l'application Flask EXPOSE 5000 -# Lancer un script pour démarrer MySQL en arrière-plan puis l'application Python -CMD service mysql start && python3 app.py +# lancer l'application Python +CMD python3 app.py diff --git a/README.md b/README.md index 497bb29..a461076 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # FreqStats +## Construction + +docker build -t flask-web-app . + +## Lancement + + +docker run -it -p 5000:5000 -v $(pwd)/src/:/src -v /home/jerome/Perso/freqtradeDocker/user_data/backtest_results:/mnt/external flask-web-app bash + +puis : python3 app.py diff --git a/README.txt b/README.txt deleted file mode 100644 index 7c2d9f0..0000000 --- a/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Construction - -docker build -t flask-web-app . - -# Lancement - -docker run -it -p 5000:5000 -v $(pwd)/src/:/src flask-web-app bash - - - - - - - diff --git a/src/app.py b/src/app.py index 45666af..ff4a251 100644 --- a/src/app.py +++ b/src/app.py @@ -1,11 +1,18 @@ -# app.py -from flask import Flask, render_template, request +import os +from flask import Flask, render_template app = Flask(__name__) @app.route('/') def home(): - return render_template('index.html') # Page d'accueil avec un formulaire ou autre contenu + # Liste les fichiers dans le répertoire monté + files = os.listdir('/mnt/external') + + # Filtre pour obtenir uniquement les fichiers (pas les dossiers) + files = [f for f in files if os.path.isfile(os.path.join('/mnt/external', f))] + + # Retourne le template avec la liste des fichiers + return render_template('index.html', files=files) @app.route('/process', methods=['POST']) def process(): diff --git a/src/env/env.dev b/src/env/env.dev new file mode 100644 index 0000000..7e87f88 --- /dev/null +++ b/src/env/env.dev @@ -0,0 +1,2 @@ +# chemin vers les backtests +BACKTESTS=/path/to/framework diff --git a/src/templates/js/echarts.js b/src/static/js/echarts.js similarity index 100% rename from src/templates/js/echarts.js rename to src/static/js/echarts.js diff --git a/src/templates/js/echarts_simple.js b/src/static/js/echarts_simple.js similarity index 100% rename from src/templates/js/echarts_simple.js rename to src/static/js/echarts_simple.js diff --git a/src/templates/index.html b/src/templates/index.html index df28ed0..2df2253 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -4,20 +4,68 @@ Statistiques Freqtrade - + + -

Bienvenue dans l'interface web !

-
- - -
+ +
+

Fichiers :

+ +
+ +
+

Graphique

+
- + + +