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.1.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

fastapi_sqlmodel_starter-1.1.1-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_sqlmodel_starter-1.1.1.tar.gz.

File metadata

  • Download URL: fastapi_sqlmodel_starter-1.1.1.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.0 Windows/10

File hashes

Hashes for fastapi_sqlmodel_starter-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c24ad4d32bff0a2a44a49bb49be01df8b157715e378fe2b3a1c6c011e71b9714
MD5 c1274ff13ba5e6412a2961f50a6a0529
BLAKE2b-256 5cc8374dfcca64b39dab4882eb8bd78ed50120e7a336a6ed1344e9948c57f5f9

See more details on using hashes here.

File details

Details for the file fastapi_sqlmodel_starter-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_sqlmodel_starter-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c678ede1c3b5737e49acbb03ad0c27e8c3a6661d245f62a6f4172a4bba8af968
MD5 61273c41b790d794a642cd6e3b519a8b
BLAKE2b-256 eb86f9299ea1a99a34d971b1872be754c6f4840b9d7a861b2e0c53fe183bc823

See more details on using hashes here.

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