本板块我将为大家总结下关于Django RESTFramework日常开发常用的相关第三方库,下面是库的清单,我将分别使用单独的文章为每个库都做一个详细的介绍,以便于我们在后面开发时有个事先的初步了解,这样我们在开发时就知道有哪些库可以帮我们提高开发效率,以及应该如何快速上手和使用。
认证
- django-rest-passwordreset: 与 Django 认证系统集成的密码重置端点参考地址:https://github.com/anx-ckreuzberger/django-rest-passwordreset
- djoser: Django 认证系统的 REST 实现参考地址:https://github.com/sunscrapers/djoser
- dj-rest-auth: 用于处理用户注册和认证任务的一组 REST API 端点参考地址:https://github.com/jazzband/dj-rest-auth
- django-rest-registration: 基于 Django REST Framework 的用户注册和认证 REST API参考地址:https://github.com/apragacz/django-rest-registration
- django-rest-framework-simplejwt: 用于 Django REST Framework 的 JSON Web Token 认证插件参考地址:https://github.com/davesque/django-rest-framework-simplejwt
- django-rest-framework-social-oauth2: 为 django-rest-framework 提供 python-social-auth 和 oauth2 支持参考地址:https://github.com/PhilipGarnero/django-rest-framework-social-oauth2
- django-oauth-toolkit: Django OAuth 工具包可以帮助你为 Django 项目添加 OAuth2 功能,提供开箱即用的所有端点、数据和逻辑。该工具包广泛使用优秀的 OAuthLib,以确保完全符合 RFC 规范。参考地址:https://github.com/jazzband/django-oauth-toolkit
- django-rest-durin: 通过单一接口为 Web/CLI/移动端 API 客户端提供令牌认证,但允许为每个客户端配置不同的令牌(例如,权限和令牌过期时间可以因 API 客户端而异)。参考地址:https://django-rest-durin.readthedocs.io/en/latest/index.html
- djangorest-routes: Djangorest Routes 是一个用 Python 强力构建的认证库,旨在快速启动项目的认证基础设施。参考地址:https://github.com/israelabraham/djangorest-routes
授权
- dry-rest-permissions: 基于规则的权限管理。参考地址:https://github.com/dbkaplan/dry-rest-permissions
- drf-access-policy: 模仿 AWS IAM 策略的声明式访问策略/权限管理。参考地址:https://github.com/rsinger86/drf-access-policy
- djangorestframework-api-key: API 密钥权限管理。参考地址:https://github.com/florimondmanca/djangorestframework-api-key
- djangorestframework-composed-permissions: 定义复杂权限的简单方法。参考地址:https://github.com/niwinz/djangorestframework-composed-permissions
- rest_condition: 复杂的权限流程管理。参考地址:https://github.com/caxap/rest_condition
- django-rest-framework-roles: 根据用户定义的角色参数化 Django REST Framework 的方法。参考地址:https://github.com/computer-lab/django-rest-framework-roles
- django-rest-framework-role-filters: 简单的角色过滤。参考地址:https://github.com/allisson/django-rest-framework-role-filters
- drf-psq: 管理基于动作的权限、序列化器和依赖权限规则的查询集的最简单且最通用的方式。参考地址:https://github.com/drf-psq/drf-psq
文档
- drf-yasg: 具有响应模式支持的 Django REST Framework 替代 OpenAPI 生成器。从 Django REST Framework 代码自动生成真实的 Swagger/OpenAPI 2.0 模式。参考地址:https://github.com/axnsan12/drf-yasg
- drf-spectacular: 为 Django REST framework 生成合理且灵活的 OpenAPI 3.0 模式。参考地址:https://github.com/tfranzel/drf-spectacular
- drf-openapi-tester: 根据 OpenAPI/Swagger 文档测试 drf 的响应。参考地址:https://github.com/snok/drf-openapi-tester
路由
- rest_framework_nested
- drf-nested-routers: Django Rest Framework 的嵌套路由器参考地址:https://github.com/alanjds/drf-nested-routers
序列化
- django-rest-framework-recursive: Django REST framework 的递归序列化参考地址:https://github.com/heywbj/django-rest-framework-recursive/
- drf-extra-fields: Django REST framework 的额外字段。参考地址:https://github.com/Hipo/drf-extra-fields/
- drf-flex-fields: 在 Django REST Framework 序列化器中动态设置字段和展开嵌套资源。参考地址:https://github.com/rsinger86/drf-flex-fields
- drf-writable-nested: Django REST Framework 的可写嵌套模型序列化器参考地址:https://github.com/beda-software/drf-writable-nested
可视化
- django-rest-pandas: 通过 Django REST Framework 提供 Pandas 数据帧,用于客户端(如 d3.js)可视化和离线分析(如 Excel)参考地址:https://github.com/wq/django-rest-pandas
- django-rest-framework-gis: Django REST Framework 的地理信息附加组件参考地址:https://github.com/djangonauts/django-rest-framework-gis
- drf-renderer-xlsx: 允许你为 Django REST Framework 创建 XLSX 文件参考地址:https://github.com/wharton/drf-renderer-xlsx
日志记录
- drf-api-tracking: 提供一个 Django 模型和 DRF 视图混入类,共同协作将 Django Rest Framework 请求记录到数据库。参考地址:https://github.com/lingster/drf-api-tracking
- django-requestlogs: 为审计日志记录提供中间件和其他辅助工具的包。参考地址:https://github.com/Raekkeri/django-requestlogs
过滤
- django-rest-framework-filters: 更好的过滤功能。参考地址:https://github.com/philipn/django-rest-framework-filters
- django-rest-framework-word-search-filter: 用于 Django REST Framework 的全文搜索过滤后端。与数据库后端无关。参考地址:https://github.com/trollknurr/django-rest-framework-word-search-filter
- django-url-filter: Django URL 过滤器提供了一种通过人性化 URL 安全过滤数据的方法。参考地址:https://github.com/miki725/django-url-filter
- drf-url-filters: 一个 Django 应用,使用查询参数和 voluptuous 验证对 drf 查询集应用过滤器。参考地址:https://github.com/manjitkumar/drf-url-filters
分页
- drf-proxy-pagination: Django REST Framework 的分页类,可通过查询参数选择分页类参考地址:https://github.com/tuffnatty/drf-proxy-pagination
- django-rest-framework-link-header-pagination: 使用 "Link" HTTP 头部为 django-rest-framework 提供分页功能参考地址:https://github.com/tbeadle/django-rest-framework-link-header-pagination
渲染器和解析器
- django-rest-framework-yaml: Django REST Framework 的 YAML 支持。参考地址:https://github.com/jpadilla/django-rest-framework-yaml
- django-rest-framework-xml: Django REST Framework 的 XML 支持。参考地址:https://github.com/jpadilla/django-rest-framework-xml
- django-rest-framework-jsonp: Django REST Framework 的 JSONP 支持。参考地址:https://github.com/jpadilla/django-rest-framework-jsonp
- drf-excel: Django REST Framework 的 XLSX 电子表格渲染器。参考地址:https://github.com/wharton/drf-excel
- django-rest-framework-csv: Django REST Framework 的 CSV 工具。参考地址:https://github.com/mjumbewu/django-rest-framework-csv
- drf-ujson-renderer: 使用 ujson 的 Django Rest Framework 渲染器。参考地址:https://github.com/gizmag/drf-ujson-renderer
- djangorestframework-camel-case: Django REST framework 的驼峰命名法 JSON 支持。参考地址:https://github.com/vbabiy/djangorestframework-camel-case
- django-rest-pandas: 通过 Django REST Framework 提供 Pandas 数据帧,用于客户端(如 d3.js)可视化和离线分析(如 Excel)。参考地址:https://github.com/wq/django-rest-pandas
- rest-framework-latex: Django REST Framework 的 LaTeX 渲染器。参考地址:https://github.com/mypebble/rest-framework-latex
其他
- django-rest-localflavor: 特定国家的 Django 辅助工具,用于 Django Rest Framework参考地址:https://github.com/gilsondev/django-rest-localflavor/
- django-rest-framework-json-api: 实现了大部分 JSON API 1.0 规范。参考地址:https://github.com/django-json-api/django-rest-framework-json-api
- drf-extensions: DRF-extensions 是 Django REST Framework 的自定义扩展集合参考地址:https://github.com/chibisov/drf-extensions
- drf-generators: 为你的 Django Rest Framework 应用生成视图、序列化器和 URL。参考地址:https://github.com/Brobin/drf-generators
- django-restql: 将你用 Django REST Framework (DRF) 构建的 API 变成类似 GraphQL 的 API。参考地址:https://github.com/yezyilomo/django-restql
- django-rest-tsg: 为 DRF 序列化器、枚举和数据类生成 TypeScript 代码。参考地址:https://github.com/jinkanhq/django-rest-tsg
- django-rest-cli: 一个 CRUD 端点生成器和灵活的 cookiecutter 模板,用于快速开发 REST API。参考地址:https://github.com/py-universe/django-rest-cli