From 4d0baebb7573d3e92f83fbf14197732eb03a5e88 Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Sun, 19 Apr 2026 15:54:36 +0200 Subject: [PATCH] =?UTF-8?q?V=C3=A9rification=20de=20l'existence=20de=20cac?= =?UTF-8?q?he=5Fdir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app.py b/src/app.py index eb3b332..acbba3a 100644 --- a/src/app.py +++ b/src/app.py @@ -33,13 +33,16 @@ app: Dash = Dash( meta_tags=META_TAGS, ) -rmtree(os.getenv("CACHE_DIR", "/tmp/decp-cache")) +cache_dir = os.getenv("CACHE_DIR", "/tmp/decp-cache") + +if os.path.exists(cache_dir): + rmtree(cache_dir) cache.init_app( app.server, config={ "CACHE_TYPE": "FileSystemCache", - "CACHE_DIR": os.getenv("CACHE_DIR", "/tmp/decp-cache"), + "CACHE_DIR": cache_dir, "CACHE_DEFAULT_TIMEOUT": int( os.getenv("CACHE_DEFAULT_TIMEOUT", 3600 * 24) ), # 24h par défaut