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:
co-authored by
Claude
parent
2b001dde95
commit
8937799973
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
数据库初始化脚本
|
||||
=============================================================
|
||||
|
||||
基于 SQLAlchemy 元数据创建全部数据表(等价 flask db upgrade 的建表)。
|
||||
适合从零初始化环境。
|
||||
|
||||
用法:
|
||||
python scripts/init_db.py
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
from src.app import create_app
|
||||
from src.core.database import db
|
||||
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
print(f"数据库表初始化完成,共 {len(db.metadata.tables)} 张表")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user