激光材料数据平台 1.3.0
公开数据看板、四位 Key 录入面板、管理后台与三级权限、动态字段配置、 PostgreSQL/SQLite 双支持、数据库备份,以及本版新增的成品图上传与预览。 图片相关: - 录入表单支持相册选图与手机端直接拍照,每条记录最多 6 张 - 浏览器内压缩到最长边 1600 并剥离 EXIF,入库统一为 JPG/PNG - 二进制直接入库,现有备份自动覆盖图片,部署无需新增卷 - 详情页缩略图宫格与全屏 lightbox,公开看板同样可见 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Settings:
|
||||
app_name: str = os.getenv("APP_NAME", "激光材料数据平台")
|
||||
secret: str = os.getenv("APP_SECRET", "dev-only-change-this-secret")
|
||||
database_url: str = os.getenv("DATABASE_URL", f"sqlite:///{BASE_DIR / 'data' / 'laser_data.db'}")
|
||||
admin_username: str = os.getenv("ADMIN_USERNAME", "admin")
|
||||
admin_password: str = os.getenv("ADMIN_PASSWORD", "Admin@123456")
|
||||
session_hours: int = int(os.getenv("SESSION_HOURS", "12"))
|
||||
backup_keep_days: int = int(os.getenv("BACKUP_KEEP_DAYS", "30"))
|
||||
backup_dir: Path = BASE_DIR / "backups"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
for directory in (BASE_DIR / "data", settings.backup_dir):
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
Reference in New Issue
Block a user