# backend/app/core/config.py from pydantic_settings import BaseSettings import os class Settings(BaseSettings): PROJECT_NAME: str = "爬虫任务调度系统" VERSION: str = "1.0.0" API_V1_STR: str = "/api" # 数据库配置 DATABASE_URL: str = "sqlite:///./spider_scheduler.db" # 文件上传配置 UPLOAD_DIR: str = "uploaded_scripts" MAX_FILE_SIZE: int = 10 * 1024 * 1024 # 10MB # Celery配置 CELERY_BROKER_URL: str = "redis://localhost:6379/0" CELERY_RESULT_BACKEND: str = "redis://localhost:6379/0" class Config: case_sensitive = True settings = Settings() # 创建上传目录 os.makedirs(settings.UPLOAD_DIR, exist_ok=True)