TemplateDoesNotExist - Django Error

I'm using Django Rest Framework. and I keep getting an error

    Exception Type: TemplateDoesNotExist
    Exception Value: rest_framework/api.html

I dont know how I'm going wrong. This is the first time I'm trying out hands on REST Framework. This is code.


    import socket, json
    from modules.data.models import *
    from modules.utils import *
    from rest_framework import status
    from rest_framework.decorators import api_view
    from rest_framework.response import Response
    from modules.actions.serializers import ActionSerializer

    def api_actions(request, format = None):

        action_type = request.POST['action_type']
        if action_type == "Shutdown" : 
            send_message = '1'
            print "Shutting Down the system..."
        elif action_type == "Enable" : 
            send_message = '1'
            print "Enabling the system..."
        elif action_type == "Disable" : 
            send_message = '1'
            print "Disabling the system..."
        elif action_type == "Restart" : 
            send_message = '1'
            print "Restarting the system..."

        if action_type in ["Shutdown", "Enable", "Disable"] : PORT = 6000
        else : PORT = 6100

        controllers_list = Controller.objects.filter(installation_id = kwargs['installation_id'])

        for controller_obj in controllers_list:
            ip = controller_obj.ip
                s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                s.connect((ip, PORT))
            except Exception as e:
                print("Exception when sending " + action_type +" command: "+str(e))

        return Response(status = status.HTTP_200_OK)


    class Controller(models.Model):
        id = models.IntegerField(primary_key = True)
        name = models.CharField(max_length = 255, unique = True)
        ip = models.CharField(max_length = 255, unique = True)
        installation_id = models.ForeignKey('Installation')


from django.forms import widgets from rest_framework import serializers from modules.data.models import *

    class ActionSerializer(serializers.ModelSerializer):
        class Meta:
            model = Controller
            fields = ('id', 'name', 'ip', 'installation_id')


    from django.conf.urls import patterns, url
    from rest_framework.urlpatterns import format_suffix_patterns

    urlpatterns = patterns('modules.actions.views',

Make sure you have rest_framework listed in your settings.py INSTALLED_APPS.

From: stackoverflow.com/q/21408344

Back to homepage or read more recommendations: