fix: configuration de StaticFiles sur FastAPI et mise à jour des liens du logo en local
Build and Push Docker Image / build-and-push (push) Successful in 39s
Build and Push Docker Image / build-and-push (push) Successful in 39s
This commit is contained in:
1 parent
554f00f2b1
commit
02ba8bfff3
3 files changed
+10
-29
No files matched your search
+6
-1
@@ -1,5 +1,6 @@
|
||||
from fastapi import FastAPI, Depends, HTTPException, status, Request, Response
|
||||
from fastapi.responses import RedirectResponse, FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from sqlalchemy.orm import Session
|
||||
import os
|
||||
|
||||
@@ -14,6 +15,11 @@ Base.metadata.create_all(bind=engine)
|
||||
|
||||
app = FastAPI(title="AETHAS38 - Orchestrateur Multi-IA")
|
||||
|
||||
# Configuration des fichiers statiques (images, css locaux, etc.)
|
||||
assets_path = os.path.join(os.getcwd(), "frontend", "assets")
|
||||
os.makedirs(assets_path, exist_ok=True) # Crée le dossier s'il n'existe pas
|
||||
app.mount("/static", StaticFiles(directory=assets_path), name="static")
|
||||
|
||||
def is_setup_required(db: Session) -> bool:
|
||||
"""Vérifie si la base de données contient au moins un administrateur."""
|
||||
admin = db.query(User).filter(User.is_admin == True).first()
|
||||
@@ -31,7 +37,6 @@ def setup_page(db: Session = Depends(get_db)):
|
||||
if not is_setup_required(db):
|
||||
return RedirectResponse(url="/login")
|
||||
|
||||
# Chemin vers le fichier HTML depuis la racine de l'application Docker (/app)
|
||||
frontend_path = os.path.join(os.getcwd(), "frontend", "index.html")
|
||||
if not os.path.exists(frontend_path):
|
||||
raise HTTPException(status_code=404, detail="Interface introuvable.")
|
||||
|
||||
Reference in new issue
Block a user