talira

Django REST framework

A powerful and flexible toolkit for building Web APIs

open sourceBSD-3-Clauseself-hostablefree

Django REST framework (DRF) is the toolkit most Django projects use to build Web APIs. Serializers turn models and other data into JSON and validate incoming data; generic views, viewsets and routers build CRUD endpoints with little code; and pluggable authentication, permissions, throttling, filtering, pagination and versioning cover what a production API needs. Its browsable API renders every endpoint as an HTML page developers can explore and submit forms on. It can generate OpenAPI schemas, and function-based views stay available when you don't need the higher-level classes. Encode maintains it, and it's BSD-3-Clause licensed.

Problems it solves

  • add a JSON API to my Django app without hand-writing every view
  • turn Django models into JSON and validate incoming request data with the same class
  • explore and test my API endpoints in the browser without Postman
  • add token, session or OAuth authentication and per-object permissions to a Django API
  • rate-limit API clients and paginate long lists in a Django backend
  • build CRUD endpoints for a model with routing generated for me
  • version my REST API without breaking existing clients
  • generate an OpenAPI schema for my Django API
  • filter and search API results by query parameters

Features

  • serializers for ORM and non-ORM data, with validation
  • generic views, viewsets and routers
  • browsable HTML API for every endpoint
  • authentication policies, with packages for OAuth1a and OAuth2
  • permissions, throttling, caching, filtering and pagination
  • API versioning and content negotiation
  • OpenAPI schema generation (with PyYAML and uritemplate)
  • test client and request factory for API tests
  • supports Django 5.2, 6.0 and 6.1 on Python 3.10 to 3.15

Capabilities

Takes pluginsplan not known

Alternatives

The same job

These do what Django REST framework does.

  1. FastAPI FastAPI framework, high performance, easy to learn, fast to code, ready for production

Compare Django REST framework with the top 3