Skip to main content

YAML support for Django REST Framework

Project description

REST Framework YAML

build-status-image pypi-version

YAML support for Django REST Framework

Full documentation for the project is available at


YAML support extracted as a third party package directly from the official Django REST Framework implementation. It's built using the PyYAML package.


  • Python (2.7, 3.3, 3.4)
  • Django (1.6, 1.7)


Install using pip...

$ pip install djangorestframework-yaml



You can also set the renderer and parser used for an individual view, or viewset, using the APIView class based views.

from rest_framework import routers, serializers, viewsets
from rest_framework_yaml.parsers import YAMLParser
from rest_framework_yaml.renderers import YAMLRenderer

# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('url', 'username', 'email', 'is_staff')

# ViewSets define the view behavior.
class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    parser_classes = (YAMLParser,)
    renderer_classes = (YAMLRenderer,)

Sample output

  is_staff: true
  url: ""
  username: jpadilla

Documentation & Support

Full documentation for the project is available at

You may also want to follow the author on Twitter.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangorestframework-yaml-2.0.0.tar.gz (5.7 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page