| 123456789101112131415161718192021222324252627282930313233 |
- from pathlib import Path
- from typing import Dict, List
- from enum import Enum
- class Settings:
- API_ImageData_prefix: str = "/api/image_data"
- BASE_PATH = Path(__file__).parent.parent.parent.absolute()
- DATA_DIR = BASE_PATH / "Data"
- SCORE_CONFIG_PATH = BASE_PATH / "app/core/scoring_config.json"
- # --- 数据库配置 ---
- DB_NAME = 'card_score_database'
- DB_TABLE_NAME = 'image_records'
- DATABASE_CONFIG: Dict[str, str] = {
- 'user': 'root',
- 'password': '123456',
- 'host': '127.0.0.1',
- }
- # 连接到指定数据库的配置
- DATABASE_CONFIG_WITH_DB: Dict[str, str] = {
- **DATABASE_CONFIG,
- 'database': DB_NAME
- }
- settings = Settings()
- print(f"项目根目录: {settings.BASE_PATH}")
- print(f"数据存储目录: {settings.DATA_DIR}")
- # DefectType = Enum("InferenceType", {name: name for name in settings.DEFECT_TYPE})
- # print()
|