Déplacement des fichiers cache et données dans le répertoire parent

Signed-off-by: Emmy D'Anello <ynerant@emy.lu>
This commit is contained in:
Emmy D'Anello 2024-06-09 17:51:24 +02:00
parent dec9f414ac
commit b3a7955a9d
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
4 changed files with 9 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.idea/
__pycache__ __pycache__
.venv .venv

View File

@ -133,19 +133,19 @@ export default function Election2024({typeResultats = "france"}) {
const [dataSieges, setDataSieges] = useState([]) const [dataSieges, setDataSieges] = useState([])
useEffect(() => { useEffect(() => {
fetch("/nupes/data/resultats/europeennes2024/blocs.json").then(response => response.json()) fetch("/data/resultats/europeennes2024/blocs.json").then(response => response.json())
.then(data => setBlocs(data)) .then(data => setBlocs(data))
fetch("/nupes/data/resultats/europeennes2024/nuances.json").then(response => response.json()) fetch("/data/resultats/europeennes2024/nuances.json").then(response => response.json())
.then(data => setNuances(data)) .then(data => setNuances(data))
fetch("/nupes/data/resultats/europeennes2024/listes.json").then(response => response.json()) fetch("/data/resultats/europeennes2024/listes.json").then(response => response.json())
.then(data => setListes(data)) .then(data => setListes(data))
if (typeResultats === "france") { if (typeResultats === "france") {
fetch("/nupes/data/resultats/europeennes2024/france.json").then(response => response.json()) fetch("/data/resultats/europeennes2024/france.json").then(response => response.json())
.then(data => setResultats(data)) .then(data => setResultats(data))
} }
else { else {
fetch(`/nupes/data/resultats/europeennes2024/${typeResultats}/${zoneId}.json`).then(response => response.json()) fetch(`/data/resultats/europeennes2024/${typeResultats}/${zoneId}.json`).then(response => response.json())
.then(data => setResultats(data)) .then(data => setResultats(data))
} }
}, []) }, [])

View File

@ -3,7 +3,7 @@ from pathlib import Path
import requests import requests
CACHE_DIR = Path(__file__).parent / 'cache' CACHE_DIR = Path(__file__).parent.parent / 'cache'
def get_file(url, filename, force_etag: str = ""): def get_file(url, filename, force_etag: str = ""):

View File

@ -9,7 +9,7 @@ from nupes.models.geographie import Region, Departement, Commune
from nupes.models.europeennes2024 import Bloc, Nuance, Liste, \ from nupes.models.europeennes2024 import Bloc, Nuance, Liste, \
ResultatsFrance, ResultatsRegion, ResultatsDepartement, ResultatsCommune ResultatsFrance, ResultatsRegion, ResultatsDepartement, ResultatsCommune
DATA_DIR = Path(__file__).parent.parent / 'data' DATA_DIR = Path(__file__).parent.parent.parent / 'data'
def exporter_listes(engine: Engine, debug: bool = False) -> None: def exporter_listes(engine: Engine, debug: bool = False) -> None: