refactor: P9 运维完善(健康端点/Docker 加固/CI-CD/scripts)

- /health 健康端点(白名单已加,Docker HEALTHCHECK 目标)
- docker-compose 加固:build context 修复、privileged false、flask_user、bridge 网络
- .github/workflows/ci.yml:flake8 + mypy + pytest(含 MySQL/Redis 服务)
- scripts/:health_check.py / init_db.py
- Makefile 更新为 src/ 结构

【验收】全项目 flake8 0;12 passed;/health 200;health_check 脚本运行正常
【注】docker-compose 实际构建验证需 Docker 环境执行

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DjangoAdmin Dev
2026-08-07 19:51:51 +08:00
co-authored by Claude
parent 2b001dde95
commit 8937799973
9 changed files with 189 additions and 17 deletions
+7 -7
View File
@@ -32,23 +32,23 @@ dev: ## 启动开发服务器(127.0.0.1:8021)
# ---- 代码质量 ----
lint: ## 静态检查(flake8 + black + isort)
flake8 application utils extensions config src tests scripts
black --check --line-length 120 application utils extensions config src tests scripts
isort --check-only application utils extensions config src tests scripts
flake8 src config tests scripts
black --check --line-length 120 src config tests scripts
isort --check-only src config tests scripts
format: ## 自动格式化(black + isort)
black --line-length 120 application utils extensions config src tests scripts
isort application utils extensions config src tests scripts
black --line-length 120 src config tests scripts
isort src config tests scripts
type-check: ## 类型检查(mypy)
mypy application src
mypy src
# ---- 测试 ----
test: ## 运行全部测试
pytest
test-cov: ## 带覆盖率运行测试
pytest --cov=application --cov-report=term-missing
pytest --cov=src --cov-report=term-missing
# ---- 数据库迁移 ----
db-migrate: ## 生成迁移脚本(模型变更后)