A Python web framework for building APIs with standard type hints, offering automatic validation, OpenAPI docs and high performance.
encode/django-rest-framework
A toolkit for building Web APIs on top of Django, with serialization, authentication policies, viewsets, and a browsable API.
- Stars
- 30,210
- Forks
- 7,091
- Open issues
- 58
- Last commit
- 9 hours ago
What is it?
Django REST framework (DRF) is a toolkit for building Web APIs on top of Django. It provides serializers that convert data from both Django ORM models and non-ORM sources into representations such as JSON, along with the matching validation logic for incoming requests.
The framework offers a range of view styles, from plain function-based views to generic class-based views and viewsets, plus routers that generate URL configuration automatically. Authentication and permission policies are built in, and optional packages add OAuth1a and OAuth2 support.
A key feature is the browsable API, a web interface that lets developers explore and test endpoints directly in the browser. The project requires Python 3.10+ and supports recent Django 5.2, 6.0 and 6.1 releases.
Key features
- 01Serializers work with both ORM models and plain data sources.
- 02Browsable API lets developers test endpoints in the browser.
- 03Built-in authentication and permission policies, with optional OAuth1a and OAuth2 packages.
- 04Viewsets and routers generate consistent endpoints and URL configuration automatically.
- 05Function-based views remain available when more control is needed.
Use cases
- Exposing Django models as JSON endpoints for a single-page or mobile frontend.
- Building internal APIs with browsable documentation for developers.
- Adding OAuth2 authentication to an existing Django application's API.
Quick start
- 1
Install the package with pip
pip install djangorestframework - 2
Add 'rest_framework' to INSTALLED_APPS in your settings
- 3
Start the development server and open the browsable API
./manage.py runserver
Things to know
- Requires Python 3.10+ and Django 5.2, 6.0 or 6.1.
- The license is listed as NOASSERTION in the metadata, so check the license file before commercial use.
Topics
FAQ
- What is django-rest-framework?
- A toolkit for building Web APIs on top of Django, with serialization, authentication policies, viewsets, and a browsable API. Django REST framework (DRF) is a toolkit for building Web APIs on top of Django. It provides serializers that convert data from both Django ORM models and non-ORM sources into representations such as JSON, along with the matching validation logic for incoming requests.
- Is django-rest-framework free to use? What license does it have?
- django-rest-framework is open source under the Other license. Check the license terms before using it in commercial products.
- Is django-rest-framework still maintained?
- Actively maintained. The last commit to django-rest-framework was on Oct 20, 2026.
- What can I use django-rest-framework for?
- Exposing Django models as JSON endpoints for a single-page or mobile frontend. Building internal APIs with browsable documentation for developers. Adding OAuth2 authentication to an existing Django application's API.
- How do I install django-rest-framework?
- Install the package with pip: pip install djangorestframework Add 'rest_framework' to INSTALLED_APPS in your settings Start the development server and open the browsable API: ./manage.py runserver
- Where can I get django-rest-framework?
- The source code and installation instructions are on GitHub: https://github.com/encode/django-rest-framework
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A high-level Python web framework that encourages rapid development and clean, pragmatic design.
A community-curated list of third-party packages, tools, tutorials, and resources for building with Django.
Open-source inventory management system with stock control, part tracking, a REST API and a plugin system, built on Python and Django.
Self-hosted, open-source workout, nutrition and body weight tracker built on Django, with a REST API and companion mobile apps.
A high-performance HTTP web framework for Go with a Martini-like API, built for REST APIs, web apps and microservices.