# Business Process Modeling 业务建模 **Repository Path**: maniacratt/business-process-modeling ## Basic Information - **Project Name**: Business Process Modeling 业务建模 - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-04 - **Last Updated**: 2026-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 高性能Web应用 基于 Tornado + MongoDB + 原生JavaScript 的企业级高性能应用 ## 🚀 快速启动 ### 开发环境 ```bash # 直接运行 python run.py # 或指定端口 python run.py --port=8888 ``` ### 生产环境(Linux高性能模式) ```bash # 启动(自动多进程) ./deploy/start.sh # 停止 ./deploy/stop.sh # 重启 ./deploy/restart.sh ``` 访问:http://localhost:8888 ## 📦 技术栈 - **Tornado 6.4** - 异步非阻塞框架 - **Motor 3.3** - MongoDB异步驱动 - **原生JavaScript** - MVC + 观察者模式 - **MongoDB** - NoSQL数据库 ## 📁 项目结构 ``` webapp/ ``` webapp/ ├── app/ # 应用代码 │ ├── config/ # 配置管理 │ │ ├── settings.py # 应用配置 │ │ └── database.py # 数据库管理 │ ├── constants/ # 常量定义 │ │ ├── status_codes.py # 状态码 │ │ └── messages.py # 消息定义 │ ├── core/ # 核心设计模式 │ │ ├── singleton.py # 单例模式 │ │ ├── factory.py # 工厂模式 │ │ └── middleware.py # 中间件 │ ├── handlers/ # 请求处理器 │ │ ├── base.py # 基础处理器 │ │ ├── page_handler.py # 页面处理器 │ │ ├── api_handler.py # API处理器 │ │ └── file_handler.py # 文件处理器 │ ├── services/ # 业务逻辑层 │ ├── repositories/ # 数据访问层 │ ├── models/ # 数据模型 │ ├── utils/ # 工具函数 │ │ ├── logger.py # 日志系统 │ │ ├── response.py # 响应格式化 │ │ └── file_storage.py # 文件存储 │ ├── routes.py # 路由配置 │ ├── app_factory.py # 应用工厂 │ ├── lifecycle.py # 生命周期管理 │ └── main.py # 应用入口 ├── templates/ # 页面模板 ├── static/ # 静态资源 │ ├── css/ # 样式 │ └── js/ # JavaScript (MVC) ├── deploy/ # 部署脚本 │ ├── start.sh # 生产启动 │ ├── stop.sh # 生产停止 │ ├── restart.sh # 重启 │ ├── supervisor.conf # Supervisor配置 │ ├── systemd.service # Systemd配置 │ └── nginx.conf # Nginx配置 ├── logs/ # 日志文件 ├── run.py # 启动入口 ├── requirements.txt # Python依赖 └── .env # 环境配置 注意:文件上传保存在 /NAS 目录(可通过.env配置) ``` ## ⚙️ 配置 编辑 `.env` 文件: ```bash # 环境 ENV=development DEBUG=True # 服务器 HOST=0.0.0.0 PORT=8888 # MongoDB MONGO_URI=mongodb://localhost:27017 MONGO_DB=webapp # 文件上传 NAS_PATH=/NAS # NAS存储路径(可自定义) MAX_FILE_SIZE=52428800 # 最大50MB ALLOWED_EXTENSIONS=jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx,txt,zip ``` **文件存储说明**: - 配置 `NAS_PATH` 指定文件上传路径(默认 `/NAS`) - 如果配置的路径不存在,自动使用本地 `uploads/` 目录 - 支持任意路径,如:`/mnt/storage`、`/data/files` 等 ## 🎯 功能特性 ### 后端架构 - ✅ **异步高性能** - Tornado多进程模式 - ✅ **分层架构** - Controller → Service → Repository → Model - ✅ **设计模式** - 单例、工厂、仓储、服务层 - ✅ **路由分离** - 独立的路由配置文件 - ✅ **生命周期管理** - 统一的启动/关闭回调 - ✅ **应用工厂** - 灵活的应用创建 ### 前端架构 - ✅ **MVC设计模式** - Model-View-Controller - ✅ **观察者模式** - 响应式数据更新 - ✅ **模块化设计** - 高内聚低耦合 - ✅ **零依赖** - 原生JavaScript实现 ### 系统功能 - ✅ **统一状态码** - 规范的API响应 - ✅ **完善日志** - 分级日志系统 - ✅ **文件管理** - 支持NAS存储 - ✅ **响应式界面** - 浅蓝白色主题 ## 📊 性能指标 - 并发连接:10,000+ - QPS:5,000+ - 响应时间:< 50ms ## 🔧 停止应用 ```bash # 生产环境 ./deploy/stop.sh # 开发环境 Ctrl+C ``` ## 📝 API文档 ### 健康检查 ``` GET /api/health ``` ### 文件上传 ``` POST /api/files/upload ``` ### 文件下载 ``` GET /api/files/download/{path} ``` ## 🚀 生产部署 详细部署文档请查看:[deploy/README.md](deploy/README.md) ### 快速部署 ```bash # 使用Supervisor sudo cp deploy/supervisor.conf /etc/supervisor/conf.d/webapp.conf sudo supervisorctl reread && sudo supervisorctl update # 使用Systemd sudo cp deploy/systemd.service /etc/systemd/system/webapp.service sudo systemctl enable webapp && sudo systemctl start webapp # 配置Nginx sudo cp deploy/nginx.conf /etc/nginx/sites-available/webapp sudo ln -s /etc/nginx/sites-available/webapp /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx ``` ## 📄 许可证 MIT License