一、项目概述
企业智能知识库 Python 后端是一套完整的企业级智能知识管理平台后端服务,基于 FastAPI 框架构建,采用模块化 APIRouter 架构,融合了文档管理、分布式文件存储、全文检索、人工智能(RAG/KAG)、知识图谱等前沿技术,为企业提供从文档创建、存储、检索、共享到智能问答的全链路知识管理解决方案。
1.1 项目定位
更多项目实战在Java突击队网:susan.net.cn/project
1.2 系统架构图
二、项目架构
2.1 模块化单体架构
项目采用**模块化单体(Module-based Monolith)**架构——单一进程运行,内部按业务域拆分为独立的 apps/ 模块,通过 FastAPI 的 APIRouter 机制实现路由隔离。
┌──────────────────────────────────────┐
│ FastAPI Application │
│ (主进程 :8080) │
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ Gateway │ │ CORS │ 中间件 │
│ │ Auth │ │ Logger │ │
│ └──────────┘ └──────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ │ │ apps/ │ │
│ │ user_auth │ │ document │ │
│ │ ┌──────────┐ │ │ ┌──────────┐ │ │
│ │ │ schemas │ │ │ │ schemas │ │ │
│ │ │ services │ │ │ │ services │ │ │
│ │ │ routers │ │ │ │ routers │ │ │
│ │ │ models │ │ │ │ models │ │ │
│ │ └──────────┘ │ │ └──────────┘ │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/file │ │ apps/search │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ai │ │ apps/graph │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ │ │ apps/ │ │
│ │ foundation │ │ statistics │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌────────────────────────────────┐ │
│ │ common/ │ │
│ │ database | redis | mongo │ │
│ │ rabbitmq | security | ... │ │
│ └────────────────────────────────┘ │
└──────────────────────────────────────┘
架构优势:
- 部署简单:一个进程即整个后端,无需服务注册中心
- 启动快:冷启动秒级完成
- 调试方便:单进程调试,所有模块在同一上下文
- 可演化:未来可按 apps/ 边界平滑拆分为独立微服务
2.2 模块清单
2.3 技术选型
三、数据库设计
3.1 数据库分布
3.2 扩展存储
3.3 数据库连接管理
common/database.py 实现了 DatabaseManager 单例,统一管理 9 个 MySQL 数据库的异步连接池:
- 惰性初始化:引擎在首次访问时创建,避免启动阻塞
- 连接池配置:pool_size=10, max_overflow=20, pool_pre_ping=True, pool_recycle=3600s
- 异步驱动:使用 asyncmy 实现真正的异步 I/O
四、核心功能模块
4.1 网关中间件(apps/gateway)
网关中间件负责请求的预处理和路由分发:
4.2 用户认证与权限(apps/user_auth)
- 认证:JWT 双 Token 机制,access_token(2 小时)+ refresh_token(7 天),HS256 签名
- 密码:BCrypt 哈希加密存储
- 权限:用户 → 角色 → 权限 三层 RBAC 模型
- 预设角色:超级管理员 / 管理员 / 编辑者 / 审阅者 / 普通用户 / 只读用户
- 团队:用户可归属多个团队,支持团队级别的协作
4.3 文档管理(apps/document)
覆盖文档全生命周期:
创建 → 编辑 → 提交审核 → 审核 → 通过 → 发布 → 归档
↑ ↓
└── 拒绝(返回编辑)──┘
核心功能:
- 文档 CRUD:标题、正文(Markdown)、分类、标签、封面图
- 文件导入解析:上传 PDF / DOCX / XLSX 自动转换为 Markdown
- PDF:基于 pymupdf,支持文本提取、标题层级检测、表格识别、图片提取上传 S3、代码块检测、粗体/等宽字体样式分析
- DOCX:基于 python-docx,支持段落样式映射、内联格式(粗体/斜体)、表格转换
- XLSX:基于 openpyxl,工作表 → Markdown 表格
- PDF 导出:基于 weasyprint,Markdown 正文 → 专业排版 PDF,支持标题、代码块、表格、图片、粗体/斜体
- 版本管理:每次修改自动生成快照版本,支持版本对比和回滚
- 评论与审核:行内评论、审核工作流(提交 → 审批 → 通过/拒绝)
- 自动保存:编辑器内容定时保存到 MongoDB,防止意外丢失
- 收藏与分享:个人收藏管理、生成分享链接
4.4 文件管理(apps/file)
- S3 兼容存储:支持 MinIO / RustFS / AWS S3,通过 S3Storage 抽象层切换
- 文件上传:multipart 上传,自动生成带日期路径的对象 Key(如 images/pdf/2026/06/29/xxx.png)
- 图片处理:集成 Pillow,支持缩略图生成
- 文件预览:在线预览常见文档、图片格式
4.5 智能搜索(apps/search)
- 全文检索:基于 Elasticsearch 倒排索引
- BM25 + 向量混合检索:关键词匹配 + 语义相似度双路并行
- RRF 融合排序:Reciprocal Rank Fusion 算法合并多路结果
- 搜索历史:用户搜索记录管理,支持热门搜索词推荐
4.6 AI 智能服务(apps/ai)
- 多模型接入:支持通义千问(Qwen)、DeepSeek,通过 OpenAI 兼容接口统一调用
- RAG 检索增强生成:文档分块 → 向量嵌入 → 混合检索 → 重排序 → LLM 生成,全链路异步
- KAG 知识增强生成:结合知识图谱的实体关系增强推理能力
- AI 对话:多轮对话,SSE 流式输出
- AI 写作:模板驱动的文档自动生成,支持大纲扩展、段落续写
- 文档智能:自动摘要、关键词提取、实体识别
- 4 级降级策略:主模型 → 重试 → 备用模型 → 兜底响应,保障可用性
4.7 知识图谱(apps/graph)
- Neo4j 图存储:实体节点 + 关系边,灵活表达知识关联
- LLM 实体抽取:AI 自动识别文档中的实体和关系,自动构建图谱
- 图查询:最短路径、社区发现、相似实体推荐
- 可视化:图数据 JSON 格式输出,前端 D3.js / ECharts 渲染
4.8 基础服务(apps/foundation)
- 系统配置:全局配置项管理(键值对),支持分组和热更新
- 字典管理:枚举值字典(类型 + 选项),系统各处统一引用
- 操作日志:全链路操作审计,记录用户、操作、参数、时间
- WebSocket 通知:实时消息推送(/ws/notification),支持审核通知、系统消息等
4.9 统计分析(apps/statistics)
- 仪表盘:系统概览数据(文档总数、用户数、存储量等)
- 趋势分析:文档增长趋势、用户活跃度变化
- 热点数据:热门文档、高频搜索词、活跃用户排行
五、通用基础设施(common/)
5.1 组件清单
5.2 关键设计
异步优先:所有外部 I/O(MySQL、Redis、MongoDB、ES、RabbitMQ、S3)均使用 async/await,单进程即可高效处理高并发。
雪花算法 ID:64 位分布式唯一 ID,起始时间戳 2024-01-01,数据中心 ID 为 1,每毫秒最多 4096 个 ID,具备时钟回拨容忍。
统一响应格式:所有 API 返回 Result[T] 格式:
{
"code": 200,
"message": "success",
"data": { ... }
}
六、API 端点概览
6.1 端点分布
6.2 API 文档
服务启动后可通过以下地址访问交互式 API 文档:
- Swagger UI:http://127.0.0.1:8080/doc.html
- OpenAPI JSON:http://127.0.0.1:8080/openapi.json
七、项目目录结构
knowledge-base-python/
├── main.py # 应用入口(FastAPI 实例 + 生命周期管理)
├── config.py # 全局配置(pydantic-settings,从 .env 加载)
├── pyproject.toml # 项目元数据 + 依赖声明
├── uv.lock # UV 依赖锁定文件
├── docker-compose.yml # 基础设施容器编排
├── .env.example # 环境变量模板
├── .gitignore
├── alembic.ini # 数据库迁移配置
│
├── common/ # 共享基础设施(13 个模块)
│ ├── database.py # 9 个 MySQL 库的连接池管理
│ ├── redis.py # Redis 管理器
│ ├── mongo.py # MongoDB 管理器
│ ├── rabbitmq.py # RabbitMQ 管理器
│ ├── security.py # JWT + BCrypt 密码
│ ├── id_generator.py # 雪花算法 ID 生成器
│ ├── base_model.py # ORM 基类
│ ├── result.py # Result[T] 统一响应
│ ├── exceptions.py # 业务异常 + 全局异常处理器
│ ├── deps.py # 依赖注入
│ ├── json_response.py # 长整型安全 JSON
│ ├── serializer.py # 序列化工具
│ └── enums.py / constants.py # 枚举与常量
│
├── apps/ # 业务模块(微服务风格目录)
│ ├── gateway/ # 网关中间件
│ │ └── middleware.py
│ │
│ ├── user_auth/ # 用户认证(RBAC)
│ │ ├── schemas/ # Pydantic 请求/响应模型
│ │ ├── services/ # 业务逻辑层
│ │ ├── routers/ # API 路由
│ │ └── models.py # SQLAlchemy ORM 模型
│ │
│ ├── document/ # 文档管理
│ │ ├── schemas/
│ │ ├── services/
│ │ │ ├── document_service.py # 文档 CRUD + 工作流
│ │ │ ├── file_parser_service.py # PDF/DOCX/XLSX → Markdown
│ │ │ └── pdf_export_service.py # Markdown → PDF
│ │ ├── routers/
│ │ └── models.py
│ │
│ ├── file/ # 文件管理
│ │ ├── schemas/
│ │ ├── services/
│ │ ├── routers/
│ │ ├── models.py
│ │ └── storage.py # S3 存储抽象
│ │
│ ├── search/ # 搜索服务
│ ├── graph/ # 知识图谱
│ ├── foundation/ # 基础服务 + WebSocket
│ ├── statistics/ # 统计分析
│ └── ai/ # AI 智能服务
│
├── alembic/ # 数据库迁移
├── scripts/ # 工具脚本
├── docs/ # 项目文档
└── sql/ # 数据库初始化脚本
八、技术亮点
8.1 全异步 I/O
所有外部调用(MySQL、Redis、MongoDB、ES、RabbitMQ、S3)均使用 Python async/await 异步驱动,单进程即可处理高并发请求,资源利用率远高于线程模型。
8.2 模块化设计
每个 apps/ 模块自包含三层架构(schemas / services / routers),可独立开发、测试,未来可平滑拆分为独立微服务。
8.3 PDF/DOCX/XLSX 智能文件解析
file_parser_service.py 实现了完整的二进制文件 → Markdown 转换管道:
8.4 Markdown → PDF 导出
pdf_export_service.py 基于 weasyprint 实现专业 PDF 导出:
- 标题 h1-h6 层级渲染
- 代码块带语法高亮背景
- Markdown 表格自动排版
- 图片从 S3 下载嵌入
- 粗体、斜体等内联样式保留
8.5 WebSocket 实时通知
兼容 SockJS 传输协议的 WebSocket 端点,支持实时推送审核通知、系统消息等,30 秒心跳保持连接活跃。
8.6 多 AI 模型适配
通过适配器模式统一接入多个 LLM 提供商(通义千问、DeepSeek),4 级降级策略保障可用性:主模型 → 重试 → 备用模型 → 兜底响应。
九、快速开始
9.1 环境要求
9.2 启动步骤
# 1. 进入项目目录
cd knowledge-base-python
# 2. 启动基础设施(MySQL、Redis、ES、MongoDB、Neo4j、MinIO、RabbitMQ)
docker compose up -d
# 3. 创建数据库(9 个 MySQL 库)
docker exec -i kb-mysql mysql -uroot -proot123456 < sql/00_create_databases.sql
# 4. 配置环境变量
cp .env.example .env
# 编辑 .env 文件,修改数据库密码、Redis/ES/Mongo 地址等
# 5. 安装 Python 依赖
uv sync
uv pip install pymupdf
# 6. 执行数据库迁移(建表)
uv run alembic upgrade head
# 7. 启动后端服务
uv run uvicorn main:app --host 0.0.0.0 --port 8080 --reload
9.3 验证
浏览器打开 http://127.0.0.1:8080/doc.html,能看到 Swagger API 文档即表示启动成功。
十、与 Java 后端对比
本项目与同一系统的 Java(Spring Cloud)后端在 API 层面完全兼容,共用同一套数据库和基础设施。两者定位不同:
选择建议:
- 需要完整功能集和视频处理能力 → Java 后端
- 追求部署简单、快速迭代、低资源占用 → Python 后端
- 两个后端可同时运行,共享同一套数据库,前端切换 API 地址即可
更多项目实战在Java突击队网:susan.net.cn/project
十一、系统效果截图
下面全部是系统实际运行截图,展示后端已经完整实现的业务能力。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
Project overview
The enterprise smart knowledge base Python backend is a complete enterprise-level smart knowledge management platform backend service based on the FastAPI framework, using the modular APIRouter structure, which integrates documents management, distributed file storage, full text retrieval, artificial intelligence (RAG/KAG), knowledge mapping, etc., to provide enterprises with a full-link knowledge management solution from document creation, storage, retrieval, sharing to smart question and answer.
1.1 Project positioning
More active projects in Java commando network: susan.net.cn/project
1.2 System architecture
II. Project structure
2.1 Modularized monomer structure
The project uses ** Module-based Monolith** structure — a single process operating with an internal split stand-alone apps/ module that isolates route through the FastAPI APIRouter mechanism.
┌──────────────────────────────────────┐
│ FastAPI Application │
│ (main process: 8080) │
│ │
│ ┌──────────┐ ┌──────────┐ │
│ Gateway
│ │ Auth │ │ Logger │ │
│ └──────────┘ └──────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ │ │ apps/ │ │
│ │ user_auth │ │ document │ │
│ │ ┌──────────┐ │ │ ┌──────────┐ │ │
│ │ │ schemas │ │ │ │ schemas │ │ │
│ │ │ services │ │ │ │ services │ │ │
│ │ │ routers │ │ │ │ routers │ │ │
│ │ │ models │ │ │ │ models │ │ │
│ │ └──────────┘ │ │ └──────────┘ │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/file │ │ apps/search │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ai │ │ apps/graph │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ apps/ │ │ apps/ │ │
│ │ foundation │ │ statistics │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌────────────────────────────────┐ │
│ │ common/ │ │
│ │ database | redis | mongo │ │
│ │ rabbitmq | security | ... │ │
│ └────────────────────────────────┘ │
└──────────────────────────────────────┘
Structural advantages:
- Simple deployment: one process, the whole back end, does not require a service registration centre
- Start fast: Cold start second complete.
- Debugging convenience: single process debugging, all modules in the same context
- Evolution: the future can smooth split as an independent microservice
2.2 List of modules
2.3 Technical selection
Database design
3.1 Database distribution
3.2 Expanded storage
3.3 Database connectivity management
Compon/database.py achieves the DatabaseManager case, centrally managing the walk-in connectors of nine MySQL databases:
- Inertization: the engine was created during the first visit to avoid the start of the blockage
- Connection pool configuration: Pool size=10, max overflow=20, Pool pre ping=True, Pool recycle=3600s
- Step-by-step: use asyncmy to achieve real step-by-step I/O
Core functional modules
4.1 Gateway intermediate (apps/gateway)
The gateway intermediate is responsible for pre-processing and route distribution of requests:
4.2 User authentication and permission (apps/user auth)
- Authentication: JWT Double Token Mechanism, access token (2 hours) + refresh token (7 days), HS256 signature
- Password: BCrypt Hash encrypted storage
-permission: User Z Role permission 3rd floor RBAC model
- Preset role: Super Administrator / Administrator / Editor / Reviewer / Normal User / Read-only User
- Teams: Users can belong to multiple teams supporting teamwork at the team level
4.3 Document management (apps/documents)
Overriding document life cycle:
Create Zoom Edit Zoom Submission Audit Zoom Zoom Archive
↑ ↓
└ - Refuse (Return to Editor) - Pie
Core functions:
- Document CRUD: Title, body (Markdown), classification, label, cover
- File import resolution: upload PDF / DOCX / XLSX to Markdown
- PDF: based on pymupdf to support text extraction, title level testing, table recognition, photo extraction upload S3, code block detection, broad font style analysis in bold/software
- DOCX: based on python-docx, supports paragraph style mapping, inline format (bold/in italics), table conversion
- XLSX: Based on openpyxl, Sheet → Markdown Table
- PDF Export: Based on weasyprint, Markdown Text — Professional layout PDF, supporting titles, code blocks, tables, pictures, bold/in italics
- Version Management: Automatically generate a snapshot version of each change to support comparison and rollback
- Comments and reviews: internal comments, review of workflow (submission for approval, adoption/rejection)
- Auto save: editor contents are saved to MongoDB on time to prevent accidental loss
- Collection and sharing: personal collection management, generation sharing chain Answer.
4.4 Document management (apps/file)
- S3 Compatible Storage: Support MinIO / RustFS / AWS S3, transition through S3Storage
- File upload: multipart upload, automatically generating objects with date paths
- Photo processing: integrated Pillow, supporting thumbnail generation
- Document preview: an online preview of common documents, photo formats
4.5 Smart search (apps/search)
- Full Text Search: Based on Elasticsearch Inverted Index
- BM25 + Vector Mixed Search: Keyword Match + Semantic Similarity Parallel
- RRF Integration Sorting: Recipal Rank Fusion
- Search history: user search records management, support hot search word references
4.6 AI Smart Services (apps/ai)
- Multi-model access: Qwen (Qwen), DeepSeek, unified call via Open AI compatible interface
- RAG Retrieval Enhancement Generation: Document Part Zoom Vector Embedded Zoom Mixed Search Zoom Reorder LLM Generation, All-Language Distance
KAG Knowledge Enhancement Generation: Increased reasoning in relation to the entity of knowledge mapping
- AI Dialogue: Multicycle Dialogue, SSE Fluid Output
- AI Writing: Template-driven documents automatically generated to support outline extensions, paragraph continuation Write
- Document intelligence: automatic summary, keyword extraction, physical recognition
-4 Level Downsight Policy: Primary Model retry Z back-up Model Z Bottom Response to Secure Usability
4.7 Knowledge mapping (apps/graph)
- Neo4j Map Storage: Physical Node + Relationship Side, Flexible Expression of Knowledge Linkage
- LLM entities extract: AI auto-identify entities and relationships in documents, auto-build maps
- Diagram queries: minimum path, community discovery, similar entity recommendations
- Visualization: Graphical data JSON format output, front-end D3.js / ECharts render
4.8 Basic services (apps/foundation)
- System configuration: global configuration item management (key pair) to support grouping and heat updates
- Dictionary Management: Enumerated Dictionary (type + option), common references across the system
- Operations log: full-link operation audit, recording users, operations, parameters, time
- WebSocket Notice: Real-time messaging (/ws/notification), supporting audit notices, system messages, etc.
4.9 Statistical analysis (apps/statistics)
- dashboard: system overview data (number of documents, number of users, storage, etc.)
- trend analysis: document growth trends, changes in user activity
- Hotspot data: hot-door documents, high-frequency search words, lined active users
General infrastructure (common/)
5.1 List of components
5.2 Key design
Cross-step priority: All external I/O (MySQL, Redis, MongoDB, ES, RabbitMQ, S3) uses async/await, which can be handled efficiently and effectively.
Snowflake algorithm ID: 64 bit distribution only ID, starting time stamp 2024-01-01, data centre ID is 1 with a maximum of 4096 IDs per millisecond and has a clock callback tolerance.
Harmonized Response Format: All API returns the Result [T] format:
{
"code": 200,
"message": "success",
"data": { ... }
}
VI. Overview of the API endpoint
6.1 Endpoint Distribution
6.2 API Documentation
An interactive API document can be accessed after service starts at the following address:
- Swagger UI:http://127.0.0.1:8080/doc.html
- OpenAPI JSON:http://127.0.0.1:8080/openapi.json
VII. Project catalogue structure
knowledge-base-python/
├-main.py # Application portal (FastAPI instance + life cycle management)
Ideas -config.py # global configuration (pydantic-settings, loaded from.env)
Ideas - pyproject.toml #Metadata+dependent declaration
uv.lock
-Docker-compose.yml # Infrastructure container organization
.env.example # Environment Variable Template
├── .gitignore
—alembic.ini # Database Migration Configuration
│
Ideas -common/ # Shared infrastructure (13 modules)
│-database.py # 9 MySQL libraries connect pool management
# Redis Manager
│-mongo.py #MongoDB Manager
│-rabbitmq.py #RabbitMQ Manager
# JWT + BCrypt password
id generator.py # Snowflake algorithm id generator
│ Think - base model.py #ORM base class
#Result [T] Unanimously Response
Ideas-expectations.py # Business abnormalities + global abnormalities Device
# Reliance on injection #
Json response.py
│- serializer.py# Sequencing tool
│-enums.py / constants.py # enumeration and constant
│
├-apps/# Business Module (Microservice Style Directory)
# In the middle of the gateway Annex
│ │ └── middleware.py
│ │
│-user mouth/ # User Authentication (RBAC)
#Pydantic request/response model
# Business logic layer
# API route
SQLAlchemy ORM Model
│ │
│-document/ # Document Management
│ │ ├── schemas/
│ │ ├── services/
│ │ ├ - document service.py# Document CRUD+workflow
│ │ │ ├── file_parser_service.py # PDF/DOCX/XLSX → Markdown
│ │ │ └── pdf_export_service.py # Markdown → PDF
│ │ ├── routers/
│ │ └── models.py
│ │
# File Management
│ │ ├── schemas/
│ │ ├── services/
│ │ ├── routers/
│ │ ├── models.py
S3 storage abstract
│ │
│-search/ # Search service
│-gram/ # Knowledge
│-foundation/ # Basic Services + WebSocket
# Statistical analysis
│-i/ #AI Smart Service
│
Alembic/ # Database Migration
# Tool scripts
# Project documents
└-sql/ # Database Initialisation Script
Technology highlights
8.1 Full variant I/O
All external calls (MySQL, Redis, MongoDB, ES, RabbitMQ, S3) are driven by Python async/await, so that single processes can handle high-level requests and resource utilization is much higher than the linear model.
8.2 Modular design
Each apps/ module contains a three-tier structure (schemas / servicees / routers) that can be developed and tested independently and will smooth the future of split as an independent microservice.
8.3 PDF/DOCX/XLSX smart file resolution
File parserver service.py completes the binary file → Markdown conversion conduit:
8.4 Markdown →PDF Export
pdf export service.py based on weasyprint to achieve professional PDF exports:
- Title h1-h6 Level rendering
- Code block with syntax.
- Markdown Table Automatically Layout
- Pictures downloaded from S3 embedded
- Intralink styles such as bold, italics, etc. are maintained
8.5 WebSocket Real-time notification
WebSocket endpoints compatible with SockJS transmission protocols, supporting real-time delivery of audit notifications, system messages, etc., 30 seconds of heart beats to remain connected.
8.6 Multi-AI model fit
Integrated access to a number of LLM providers (Qwen, DeepSeek) through adapter modes, 4 downgrade policy to guarantee usability: main model retry → back-up model → bottom response.
IX. Quick start
9.1 Environmental requirements
9.2 Initial steps
1. Access to the project catalogue
cd knowledge-base-python
#2 Start infrastructure (MySQL, Redis, ES, MongoDB, Neo4j, MinIO, RabitMQ)
docker compose up -d
# 3. Create Database (9 MySQL libraries)
docker exec -i kb-mysql mysql -uroot -proot123456 < sql/00_create_databases.sql
4. Configure environmental variables
cp .env.example .env
# Edit.env files, modify database passwords, Redis/ES/ Mongo addresses, etc.
5. Install Python Dependence
uv sync
uv pip install pymupdf
6. Implement database migration (forms)
uv run alembic upgrade head
#7. Start backend service
uv run uvicorn main:app --host 0.0.0.0 --port 8080 --reload
9.3 Validation
Browser opens http://127.0.0.1:8080/doc.html to see a Swagger API document as a startup success.
X. COMPARATION WITH Java Backend
The project is fully compatible with the back end of the same system, Java (Spring Cloud) at the API level, sharing the same database and infrastructure. The two are located differently:
Select proposal:
- Need full functionality set and video processing capability → Java backend
- Seek to deploy simple, fast iterative, low resource occupation backend of Python
- Two backends can run simultaneously, share the same database, switch the API address to the front end
More active projects in Java commando network: susan.net.cn/project
XI. System Impact Screenshot
All of the following are a screenshot of the actual operation of the system, showing the full operational capability of the back end.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.