Fixed assets mounting in app and container

This commit is contained in:
Dmitriy Shishkov 2023-09-08 19:40:33 +03:00
parent 0df1d50612
commit 543b7b0c46
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
7 changed files with 8 additions and 3 deletions

View File

@ -29,4 +29,7 @@ dist-ssr
uploads/
.env
poems.txt
poem_pic/
__pycache__

2
.gitignore vendored
View File

@ -29,4 +29,6 @@ dist-ssr
uploads/
.env
poem_pic/
__pycache__

View File

@ -35,5 +35,5 @@ Only docker/podman are required
```sh
docker build . -t porridger:build
docker run --name porridger -p 8000:8000 -v ./sql_app.db:/srv/sql_app.db -v uploads:/srv/uploads -v poem_pic:/srv/poem_pic porridger:build
docker run --name porridger -p 8000:8000 -v ./sql_app.db:/srv/sql_app.db -v ./poems.txt:/srv/poems.txt -v ./poem_pic:/srv/poem_pic -v uploads:/srv/uploads porridger:build
```

View File

@ -10,7 +10,7 @@ import datetime
# Загружаем стихи
async def add_poems_to_db(async_db: AsyncSession):
f1 = open('text121.txt', encoding='utf-8', mode='r')#открыть фаил для чтения на русском
f1 = open('poems.txt', encoding='utf-8', mode='r')#открыть фаил для чтения на русском
for a in range(1, 110):
f1.seek(0)#перейти к началу
i=0

View File

@ -46,7 +46,7 @@ app.mount("/uploads", StaticFiles(directory = "./uploads"))
# эндпоинт для возвращения согласия в pdf
@app.get("/privacy_policy.pdf")
async def privacy_policy():
return FileResponse("privacy_policy.pdf")
return FileResponse("./privacy_policy.pdf")
# получение списка объявлений
@app.get("/api/announcements", response_model=List[pydantic_schemas.Announcement])#адрес объявлений

BIN
privacy_policy.pdf Normal file

Binary file not shown.