Public Access
Retour au StaticFiles officiel
Build and Push Docker Image / build-and-push (push) Successful in 36s
Build and Push Docker Image / build-and-push (push) Successful in 36s
This commit is contained in:
1 parent
0a73ef3bab
commit
cbe8d8ec6d
1 file changed
+1
-12
@@ -49,19 +49,8 @@ app, rt = fast_app(
|
|||||||
)
|
)
|
||||||
|
|
||||||
app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo")
|
app.mount("/Logo", StaticFiles(directory="Logo"), name="Logo")
|
||||||
# (J'ai supprimé l'ancien montage /Media capricieux de Docker)
|
|
||||||
|
|
||||||
# --- ROUTE DÉDIÉE - LECTURE EN MÉMOIRE VIVE ---
|
app.mount("/Media", StaticFiles(directory=dossier_media), name="Media")
|
||||||
@rt('/Media/{fname}')
|
|
||||||
def get(fname: str):
|
|
||||||
chemin = os.path.join(dossier_media, fname)
|
|
||||||
try:
|
|
||||||
# On lit le fichier binaire brutalement sans passer par FileResponse
|
|
||||||
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 en RAM : {e}", status_code=500)
|
|
||||||
|
|
||||||
# --- ROUTES D'AUTHENTIFICATION ---
|
# --- ROUTES D'AUTHENTIFICATION ---
|
||||||
@rt('/login')
|
@rt('/login')
|
||||||
|
|||||||
Reference in new issue
Block a user