Skip to content

Introduction

Django REST Framework (DRF) is a powerful and flexible toolkit for building Web APIs in Django.

Why use DRF?

  • Web browsable API: A massive usability win for your developers.
  • Serialization: Supports both ORM and non-ORM data sources.
  • Customizable: Highly customizable, allowing you to use regular function-based views if you don't need the more powerful features.
  • Community: Extensive documentation and great community support.

Core Components

ComponentPurpose
SerializersConvert complex data (like model instances) into native Python datatypes that can be easily rendered into JSON/XML, and vice versa.
Views / ViewSetsHandle the logic for answering requests and returning responses. DRF provides generic views to speed up common patterns.
RoutersAutomatically generate URLs for your API by wiring up ViewSets.
Authentication & PermissionsSecure your API by identifying users and defining access control rules.