Skip to main content

Fss aims to be one of the best scaffold in PyWeb.

Project description

FastAPI SQLModel Starter (Fss)

logo

GitHub License PyPI - Python Version CI Codecov Read the Docs

简体中文 | English

PyWeb领域最好用的脚手架之一。

特性

  • ⚡ 开箱即用, 完全实现中间件零依赖
    • 默认使用Sqlite, 也可自由切换PostgreSQL、MySQL
    • 默认使用文件缓存, 支持切换为Redis
  • 🚢 开启Python操作数据库表结构的新体验
  • 🚀 内置单表常见操作, 简化ORM操作
  • 🎨 丰富插件机制
    • Jwt安全认证
    • 访问限流
    • Ip黑名单
  • 🐋 完备容器化解决方案
    • Docker
    • Docker-compose
    • Kubernetes
  • ✅ 基于GitHub Actions的CI (持续集成) 和 CD (持续交付)

文档

设置一个conda的虚拟环境

这部分是可选的,但可能对新学 Python 的用户有用。

通常来说, 虚拟环境可以解决包冲突和多版本Python等问题, conda是管理包和环境的一种选择. 在Linux上,可以从这里下载Miniconda, 并按照说明进行安装。

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

设置镜像源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes

创建带有Python 3.11(>=3.9)的Fss虚拟环境

conda create -n fss_py311 python==3.11 -y

激活虚拟环境

conda activate fss_py311

快速开始

  1. 克隆代码
git clone https://github.com/tyvekzhang/fastapi-sqlmodel-starter
cd fastapi-sqlmodel-starter
  1. 安装 Poetry并下载依赖
  • 通过虚拟环境安装
    conda install poetry -y
    poetry install
    
  • 或者通过pip安装, 首先要设置镜像源
    mkdir -p ~/.pip
    cat > ~/.pip/pip.conf << EOF
    [global]
    trusted-host = mirrors.aliyun.com
    index-url = http://mirrors.aliyun.com/pypi/simple/
    EOF
    
    pip install poetry
    poetry install
    
  1. 数据库迁移
cd fss && alembic upgrade head
  1. 启动
python apiserver.py
  1. 交互式文档地址: http://127.0.0.1:9010/docs
  2. 恭喜你, 运行成功. 接口访问前需创建用户, 并进行认证
  3. 可以随时按CTRL+C停止运行

许可证

FastapiSqlmodelStarter 采用 MIT 许可证开源。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_sqlmodel_starter-1.1.0.tar.gz (30.1 kB view hashes)

Uploaded Source

Built Distribution

fastapi_sqlmodel_starter-1.1.0-py3-none-any.whl (49.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page