change path

This commit is contained in:
quantulr
2022-10-06 18:45:12 +08:00
parent 6d0e25bbf1
commit db08869691
2 changed files with 2 additions and 3 deletions

View File

@ -36,4 +36,4 @@ async def root():
def runApp():
uvicorn.run("pics_server.main:app",
host="127.0.0.1", port=8000, reload=True)
host="0.0.0.0", port=8000, reload=True)

View File

@ -18,7 +18,7 @@ from ..sql import crud
router = APIRouter()
@router.get("/image/upload_history", response_model=list[schemas.image.Image], tags=['图片'])
@router.get("/image/history", response_model=list[schemas.image.Image], tags=['图片'])
def read_image_upload_history(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
pics = crud.get_pics(db, skip=skip, limit=limit)
return pics
@ -56,7 +56,6 @@ async def create_pic(pic: UploadFile, db: Session = Depends(get_db)):
allowFileType = ["image/jpeg", "image/gif", "image/png"]
if (pic.content_type not in allowFileType):
raise HTTPException(status_code=500, detail="只能上传图片文件")
print(pic.content_type)
upload_time = strftime('%Y/%m/%d')
picBytes = await pic.read()
fileSize = len(picBytes)