Skip to content

Latest commit

 

History

History
125 lines (88 loc) · 3.54 KB

File metadata and controls

125 lines (88 loc) · 3.54 KB

Litefs 文档

Litefs 是一个轻量级的 Python Web 框架,提供高性能的 HTTP 服务器、现代路由系统、WSGI/ASGI 支持、中间件系统、缓存管理等功能。

📖 文档导航

快速开始

核心功能

测试文档

进阶指南

项目文档

API 文档

🚀 快速示例

from litefs import Litefs
from litefs.routing import get, post

app = Litefs(host='0.0.0.0', port=8080, debug=True)

@get('/', name='index')
def index_handler(request):
    return 'Hello, World!'

@get('/user/{id}', name='user_detail')
def user_detail_handler(request, id):
    return f'User ID: {id}'

@post('/login', name='login')
def login_handler(request):
    username = request.data.get('username')
    password = request.data.get('password')
    return {'status': 'success', 'username': username}

app.register_routes(__name__)
app.run()

📦 安装

pip install litefs

或从源码安装:

git clone https://github.com/leafcoder/litefs.git
cd litefs
pip install -r requirements.txt
python setup.py install

✨ 功能特性

  • 高性能 HTTP 服务器 - 支持 epoll 和 greenlet
  • 现代路由系统 - 装饰器风格、方法链风格
  • WSGI/ASGI 兼容 - 支持 Gunicorn、Uvicorn 等
  • 中间件系统 - 日志、安全、CORS、限流
  • 多级缓存 - Memory、Tree、Redis、Database、Memcache
  • 会话管理 - Database、Redis、Memcache 后端
  • 静态文件服务 - 自动 MIME 类型、安全防护
  • 健康检查 - 内置健康检查端点
  • 文件监控 - 热重载支持

🔗 相关链接

📝 文档说明

本文档使用 Docsify 构建,支持实时渲染和搜索。

本地预览文档:

# 使用 docsify-cli
docsify serve docs

# 或使用 Python HTTP 服务器
cd docs
python -m http.server 8000

然后访问 http://localhost:8000 查看文档。

📄 License

MIT License - 详见 LICENSE