| 12345678910111213141516171819202122232425262728 |
- # backend/app/core/config.py
- from pydantic_settings import BaseSettings
- import os
- from pathlib import Path
- class Settings(BaseSettings):
- PROJECT_NAME: str = "爬虫任务调度系统"
- VERSION: str = "1.0.0"
- API_V1_STR: str = "/api"
-
- # 数据库配置
- DATABASE_URL: str = "sqlite:///./spider_scheduler.db"
-
- # 文件上传配置
- BASE_DIR: Path = Path(__file__).parent.parent.parent
- UPLOAD_DIR: str = "uploaded_scripts"
-
- # CORS配置
- CORS_ORIGINS: list = ["*"]
-
- class Config:
- case_sensitive = True
- settings = Settings()
- # 创建上传目录
- upload_path = settings.BASE_DIR / settings.UPLOAD_DIR
- upload_path.mkdir(exist_ok=True)
|