23 Star 239 Fork 116

Hendy.xu / fastapi-vue-blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

FastAPI Vue Blog博客

PS: 准备开发V2版本,敬请期待

# gitee
https://gitee.com/xuqihui/fastapi-vue-blog

# github
https://github.com/xqhgit/fastapi-vue-blog

介绍

fastapi-vue-blog Python异步Web后端实现博客系统

后端

  • Python Web 框架:FastAPI
  • 数据库:MySQL
  • ORM:SQLAlchemy
  • 搜索:Elasticsearch

前端

  • 框架:Vue
  • 博客界面:BootstrapVue
  • 管理界面:ElementUI

基本要求

  • Python: 3.7.x
  • MySQL: 5.7.x
  • Node: 12.13.x
  • Vue: 2.x

功能

游客

  1. 可以看到所有文章
  2. 可以看到所有类别
  3. 可以根据分类筛选文章列表
  4. 在文章中可以看到评论
  5. 全文搜索

管理员

  1. 数据统计
  2. 文章管理
  3. 类别管理
  4. 评论管理

源码下载

git clone https://gitee.com/xuqihui/fastapi-vue-blog.git
# 或
git clone https://gitee.com/xuqihui/fastapi-vue-blog

安装

后端

1: 安装Python 3.7.x,创建虚拟环境
2: 安装MySQL 5.7.x
3: 安装elasticsearch 7.17.0 可以通过docker启动一个

前端

1: 安装Node版本 12.13.x 和 vue-cli

开发启动

后端

# 后端配置数据库和账号密码
1: cd fastapi-vue-blog/webapi
2: 修改.env文件

# 初始化和启动
1: cd fastapi-vue-blog/webapi
2: pip install -r requirements.txt
3: python3 db/init_db.py        # 如果需要初始化数据库
4: python3 app.py
5: http://localhost:8000/docs   # 进入SwaggerUI

前端

1: cd fastapi-vue-blog/webui
2: npm install
3: npm run dev
4: http://localhost:8080        # 进入前端页面
4: http://localhost:8080/admin  # 进入管理员页面

部署与发布

  • 前提:安装好Docker和docker-compose

简单发布(可能不适合生产环境)

构建和启动

# 工作目录
cd fastapi-vue-blog

# 1.构建镜像并启动服务
docker-compose up -d --build

# 2.初始化数据
docker-compose exec webapp python db/init_db.py
docker-compose restart

# 3.查看服务情况
docker-compose ps

其他命令

# 1.重启服务
docker-compose restart

# 2.启动服务
docker-compose start <服务名称>

# 3.停止服务
docker-compose stop <服务名称>

# 4.关闭服务并移除容器
docker-compose down

图片预览

avatar avatar avatar avatar avatar avatar avatar avatar

MIT License Copyright (c) 2020 Hendy.xu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

fastapi-vue-blog Python异步后端开源博客 后端框架:FastAPI 前端框架:Vue 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/xuqihui/fastapi-vue-blog.git
git@gitee.com:xuqihui/fastapi-vue-blog.git
xuqihui
fastapi-vue-blog
fastapi-vue-blog
master

搜索帮助