Giter Site home page Giter Site logo

fastapi-template's Introduction

Fastapi demo

技术栈

  • fastapi
  • tortoise-orm
  • aerich
  • redis
  • mysql
  • ....

使用说明

  1. 安装依赖
    pip install -r requirements.txt
  2. 创建数据库 fastapi, 选择 utf8mb4 编码
  3. 新建 app/config.py 配置文件, 填入以下信息
    environment_config = 'dev'
    # 那么读取的就是dev.ini文件中的配置信息
  4. app/conf/dev.ini 文件中修改配置信息,包括刚才新建的数据库配置信息
  5. 执行数据库迁移
    cd app/aerich
    
    # demo中可省略两步
    # aerich init -t env.TORTOISE_ORM  
    
    aerich init-db
    
    aerich upgrade
    
    # 当更新数据库 model 后,执行下面两个命令进行迁移
    aerich migrate
    
    aerich upgrade
  6. 启动 redis
  7. 修改dev.ini中的redis配置信息
  8. 执行 app/main.py 文件启动服务
  9. 访问 http://127.0.0.1:3002/v1/docs
  10. 初始化测试数据
    cd app
    
    执行 init_data.py 文件 初始化管理员用户

fastapi-template's People

Contributors

lvshaoyuan avatar

Stargazers

 avatar cc avatar

Watchers

 avatar

Forkers

baron2050

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.