Переделал докер
This commit is contained in:
parent
97f9a1706a
commit
3794142b67
1 changed files with 2 additions and 3 deletions
|
@ -1,4 +1,3 @@
|
||||||
import os
|
|
||||||
import uuid
|
import uuid
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
@ -8,7 +7,7 @@ from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
|
|
||||||
def generate_uuid_from_file(file_content):
|
def generate_uuid_from_file(file_content):
|
||||||
namespace_oid = uuid.UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')
|
namespace_oid = uuid.UUID("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
|
||||||
return uuid.uuid5(namespace_oid, str(file_content))
|
return uuid.uuid5(namespace_oid, str(file_content))
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ app = FastAPI(
|
||||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||||
|
|
||||||
|
|
||||||
@app.post('/upload_avatar', response_model=dict[str, str])
|
@app.post("/upload_avatar", response_model=dict[str, str])
|
||||||
async def upload_avatar(file: UploadFile):
|
async def upload_avatar(file: UploadFile):
|
||||||
content = await file.read()
|
content = await file.read()
|
||||||
name = generate_uuid_from_file(content)
|
name = generate_uuid_from_file(content)
|
||||||
|
|
Loading…
Add table
Reference in a new issue