From 05c4773a50d65522c8140965606ba6be4f0f1a0f Mon Sep 17 00:00:00 2001 From: Arity-T Date: Tue, 3 Feb 2026 13:05:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B1=D0=B4=20=D0=B2=20=D0=BF=D0=B0=D0=BF?= =?UTF-8?q?=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 2 +- .gitignore | 2 +- Dockerfile | 2 +- docker-compose.yml | 2 +- src/config.py | 3 ++- src/database.py | 3 +++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 714b6fe..333c990 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,7 +8,7 @@ __pycache__ *.pyc data/ data_partial/ -bot.db +db/ *.md !README.md .ruff_cache diff --git a/.gitignore b/.gitignore index b5dc801..8cdd500 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ TASK.md .env data/ data_partial/ -bot.db \ No newline at end of file +db/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cf74ed5..aea5e56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ COPY src/ ./src/ RUN mkdir -p data data_partial -CMD ["uv", "run", "main.py"] +CMD ["uv", "run", "--no-dev", "main.py"] diff --git a/docker-compose.yml b/docker-compose.yml index dec95be..5493c4f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,4 +9,4 @@ services: volumes: - ./data:/app/data - ./data_partial:/app/data_partial - - ./bot.db:/app/bot.db + - ./db:/app/db diff --git a/src/config.py b/src/config.py index 4b911f9..6c096c1 100644 --- a/src/config.py +++ b/src/config.py @@ -22,4 +22,5 @@ BASE_DIR: Path = Path(__file__).parent.parent DATA_DIR: Path = BASE_DIR / "data" DATA_PARTIAL_DIR: Path = BASE_DIR / "data_partial" SCENARIOS_DIR: Path = BASE_DIR / "scenarios" -DB_PATH: Path = BASE_DIR / "bot.db" +DB_DIR: Path = BASE_DIR / "db" +DB_PATH: Path = DB_DIR / "bot.db" diff --git a/src/database.py b/src/database.py index d9191b8..51750d8 100644 --- a/src/database.py +++ b/src/database.py @@ -91,7 +91,10 @@ def get_connection() -> Generator[sqlite3.Connection, None, None]: def init_db() -> None: """Инициализирует схему базы данных.""" + from src.config import DB_DIR + logger.info("Инициализация базы данных...") + DB_DIR.mkdir(parents=True, exist_ok=True) with get_connection() as conn: conn.executescript("""