Я пытаюсь найти способ вставить изображение с помощью FastAPI, это мой код:
app = FastAPI()
app.add_middleware(
CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"]
)
@app.get("/files/{file_path:path}")
def read_user_me(file_path: str):
html_content = """
<html>
<head>
<title>Some HTML in here</title>
</head>
<body>
<img src="file:///Users/user/Desktop/document/app//{0}"></img>
</body>
</html>
"""
html_content = html_content.format(file_path,file_path)
return HTMLResponse(content=html_content, status_code=200)
Когда я запускаю единорога и открываю localhost. Я получаю следующую ошибку:
Не разрешено загружать локальный ресурс: file: ///Users/user/Desktop/document/app//img.jpg
Пожалуйста, помогите