diff --git a/app/main.py b/app/main.py index b6c585d..73e7c5a 100644 --- a/app/main.py +++ b/app/main.py @@ -15,10 +15,10 @@ def generate_random_string(length=16): app = FastAPI( prefix="/api", - tags=["Сервак для загрузки"] + tags=["Сервак для загрузки"], ) -origins = ['*'] +origins = [] app.add_middleware( CORSMiddleware, @@ -40,8 +40,8 @@ app.mount("/static", StaticFiles(directory="app/static"), name="static") @app.post('/images', response_model=dict[str, str]) async def upload_images(file: UploadFile): name = generate_random_string() - image_url = f'app/static/images/{name}_avatar.png' - with open(image_url, 'wb+') as file_object: + image_url = f'static/images/{name}_avatar.png' + with open('app/' + image_url, 'wb+') as file_object: shutil.copyfileobj(file.file, file_object) return {'image_url': image_url} diff --git a/app/static/images/WydCxlHkhDVjZFu5_avatar.png b/app/static/images/WydCxlHkhDVjZFu5_avatar.png new file mode 100644 index 0000000..258d91c Binary files /dev/null and b/app/static/images/WydCxlHkhDVjZFu5_avatar.png differ diff --git a/bp/9r3IBte2WYjpceAK_avatar.png b/bp/9r3IBte2WYjpceAK_avatar.png new file mode 100644 index 0000000..258d91c Binary files /dev/null and b/bp/9r3IBte2WYjpceAK_avatar.png differ diff --git a/docker-compose.yml b/docker-compose.yml index f763b0b..f2f0637 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ -version: '3' +version: '3.8' services: uploader_server: - image: uploader_server + image: urec56/uploader_server build: context: . container_name: uploader_server @@ -9,4 +9,4 @@ services: - 127.0.0.1:7777:8000 restart: always volumes: - - ./bp:/BP \ No newline at end of file + - ./bp:/BP/app/static/images