Files
blogweb/backend/app/core/config.py
T
2025-12-26 17:29:22 +08:00

45 lines
1.0 KiB
Python

"""
应用配置
"""
from pydantic_settings import BaseSettings
from typing import Optional
class Settings(BaseSettings):
"""应用配置类"""
# 项目信息
PROJECT_NAME: str = "个人博客网站"
VERSION: str = "0.1.0"
API_V1_STR: str = "/api/v1"
# 数据库配置
DATABASE_URL: str = "sqlite:///./blogweb.db"
# 安全配置
SECRET_KEY: str = "your-secret-key-change-in-production" # 生产环境请修改
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7天
# CORS 配置
BACKEND_CORS_ORIGINS: list = [
"http://localhost:3000",
"http://localhost:5173",
"http://localhost:8080",
]
# 文件上传配置
UPLOAD_DIR: str = "./uploads"
MAX_UPLOAD_SIZE: int = 10 * 1024 * 1024 # 10MB
# 第三方 API 配置
OPENWEATHER_API_KEY: Optional[str] = None # OpenWeatherMap API Key
class Config:
env_file = ".env"
case_sensitive = True
settings = Settings()