Public Access
This commit is contained in:
1 parent
2b80986785
commit
4a6c03e338
1 file changed
+1
-12
@@ -52,19 +52,8 @@ app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo")
|
|||||||
# (J'ai supprimé l'ancien montage /Media capricieux de Docker)
|
# (J'ai supprimé l'ancien montage /Media capricieux de Docker)
|
||||||
|
|
||||||
# --- ROUTE DÉDIÉE POUR L'AFFICHAGE ET TÉLÉCHARGEMENT DES MÉDIAS ---
|
# --- ROUTE DÉDIÉE POUR L'AFFICHAGE ET TÉLÉCHARGEMENT DES MÉDIAS ---
|
||||||
@rt('/Media/{filename:path}')
|
|
||||||
def get(filename: str):
|
|
||||||
chemin = os.path.join(dossier_media, filename)
|
|
||||||
if os.path.exists(chemin):
|
|
||||||
try:
|
|
||||||
# Lecture "brute" pour contourner le bug des disques RAID sous Docker
|
|
||||||
with open(chemin, "rb") as f:
|
|
||||||
donnees_image = f.read()
|
|
||||||
return Response(content=donnees_image, media_type="image/png")
|
|
||||||
except Exception as e:
|
|
||||||
return HTMLResponse(f"Erreur de lecture sur le disque : {str(e)}", status_code=500)
|
|
||||||
|
|
||||||
return HTMLResponse(f"Image introuvable physiquement : {chemin}", status_code=404)
|
app.mount("/Media", StaticFiles(directory=dossier_media), name="Media")
|
||||||
|
|
||||||
# --- ROUTES D'AUTHENTIFICATION ---
|
# --- ROUTES D'AUTHENTIFICATION ---
|
||||||
@rt('/login')
|
@rt('/login')
|
||||||
|
|||||||
Reference in new issue
Block a user