From 2111a2050cb50fac4a45e003511b55eee6d3dbb0 Mon Sep 17 00:00:00 2001 From: Laurent FAVOLE Date: Mon, 27 Jan 2025 12:35:53 +0100 Subject: [PATCH] Always load the .env file If the app is run in another way than `python app.py`, the environment file will not be loaded. --- app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 27f9ad5..34a388e 100644 --- a/app.py +++ b/app.py @@ -4,10 +4,12 @@ import os from flask import Flask, render_template, request from datetime import datetime, timedelta -# IMPORT DES MODULES +# IMPORT DES MODULES from modules.Classes import * -# On charge les variables d'environnement par défaut pour avoir la liste des cinémas +# On charge les variables d'environnement... +dotenv.load_dotenv(".env") +# et celles par défaut pour avoir la liste des cinémas dotenv.load_dotenv(".env.sample") WEBSITE_TITLE = os.environ.get("WEBSITE_TITLE", "GrainParisArt") @@ -59,7 +61,7 @@ def getShowtimes(date): "seances": {} } - + if theater.name not in data[movie.title]["seances"].keys(): data[movie.title]["seances"][theater.name] = [] @@ -140,4 +142,4 @@ def home(): ) if __name__ == '__main__': - app.run() \ No newline at end of file + app.run() \ No newline at end of file