Skip to content

Installation

Getting started with DRF is straightforward.

Requirements

  • Python (3.6+)
  • Django (3.0+)

Step-by-step Guide

  1. Install using pip:

    bash
    pip install djangorestframework
  2. Add to INSTALLED_APPS: Open your project's settings.py and add 'rest_framework' to your installed apps.

    python
    INSTALLED_APPS = [
        ...
        'rest_framework',
    ]
  3. Global Settings (Optional): You can configure global DRF settings in settings.py using the REST_FRAMEWORK dictionary.

    python
    REST_FRAMEWORK = {
        # Use Django's standard `django.contrib.auth` permissions,
        # or allow read-only access for unauthenticated users.
        'DEFAULT_PERMISSION_CLASSES': [
            'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
        ]
    }