Installation

You can install rest_framework_channels via pip.

pip install rest_framework_channels

Setting

After installing it, you should insert 'rest_framework_channels' in the INSTALLED_APPS.

INSTALLED_APPS = [
    # Websocket
    'daphne',
    'channels',
    'rest_framework_channels', # add
    ...

You can configure the default classes and so on in settings.py.

REST_FRAMEWORK_CHANNELS = {
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework_channels.permissions.AllowAny'
    ],
    'JSON_ENCODER_CLASS': None,
    # Generic action handler behavior
    'DEFAULT_PAGINATION_CLASS': None,
    'DEFAULT_FILTER_BACKENDS': [],
    # Pagination
    'PAGE_SIZE': None,
}

Important

The configuration for all settings except DEFAULT_PERMISSION_CLASSES is same as original rest_framework. See docs for more details.