# python-blog **Repository Path**: ayiba/python-blog ## Basic Information - **Project Name**: python-blog - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-16 - **Last Updated**: 2026-09-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Python Blog 一个基于 Python FastAPI 和 Vue 3 的现代化博客系统。 ## 功能特性 - **用户系统**: 注册、登录、个人中心 - **文章管理**: Markdown 支持的博客文章 CRUD - **评论系统**: 文章评论功能 - **轮播图管理**: 首页轮播图管理 - **响应式设计**: 适配各种设备 ## 技术栈 **后端** - FastAPI - 高性能 Python Web 框架 - SQLAlchemy - Python SQL 工具包 - Pydantic - 数据验证 - JWT - 用户认证 **前端** - Vue 3 - 渐进式 JavaScript 框架 - TypeScript - JavaScript 的超集 - Vite -下一代前端构建工具 - Vue Router - 官方路由管理器 - Pinia - Vue 状态管理 ## 项目结构 ``` python-blog/ ├── backend/ # FastAPI 后端 │ ├── api/ # API 路由 │ │ ├── auth.py # 认证相关接口 │ │ ├── carousel.py # 轮播图接口 │ │ ├── comments.py # 评论接口 │ │ ├── posts.py # 文章接口 │ │ ├── upload.py # 文件上传 │ │ └── users.py # 用户接口 │ ├── core/ # 核心配置 │ ├── db/ # 数据库配置 │ ├── models/ # 数据模型 │ ├── schemas/ # Pydantic 模型 │ └── main.py # 应用入口 │ └── portalui/ # Vue 3 前端 ├── src/ │ ├── api/ # API 调用 │ ├── components/ # 公共组件 │ ├── stores/ # 状态管理 │ ├── views/ # 页面视图 │ └── router/ # 路由配置 └── index.html ``` ## 快速开始 ### 后端设置 1. 进入后端目录: ```bash cd backend ``` 2. 安装依赖: ```bash pip install -r requirements.txt ``` 3. 配置数据库(编辑 `backend/core/config.py`) 4. 启动服务: ```bash uvicorn main:app --reload ``` 后端服务运行在 `http://localhost:8000` ### 前端设置 1. 进入前端目录: ```bash cd portalui ``` 2. 安装依赖: ```bash npm install ``` 3. 启动开发服务器: ```bash npm run dev ``` 前端服务运行在 `http://localhost:5173` ## API 文档 启动后端服务后,可通过以下地址访问 API 文档: - Swagger UI: `http://localhost:8000/docs` - ReDoc: `http://localhost:8000/redoc` ### 主要接口 **认证接口** - `POST /api/auth/register` - 用户注册 - `POST /api/auth/login` - 用户登录 - `GET /api/auth/me` - 获取当前用户信息 **文章接口** - `GET /api/posts` - 获取文章列表 - `GET /api/posts/{post_id}` - 获取文章详情 - `POST /api/posts` - 创建文章 - `PUT /api/posts/{post_id}` - 更新文章 - `DELETE /api/posts/{post_id}` - 删除文章 **评论接口** - `GET /api/comments/{post_id}` - 获取文章评论 - `POST /api/comments/{post_id}` - 发表评论 - `DELETE /api/comments/{comment_id}` - 删除评论 **轮播图接口** - `GET /api/carousel` - 获取轮播图列表 - `POST /api/carousel` - 添加轮播图(需要管理员权限) - `PUT /api/carousel/{item_id}` - 更新轮播图 - `DELETE /api/carousel/{item_id}` - 删除轮播图 ## License MIT License