Build REST API using DRF

pip install djangorestframework
django-admin startproject djangoCore
cd djangoCore
python startapp myApp
class StudentRecord(models.Model):
python makemigrations myApp
python migrate
from rest_framework.serializers import ModelSerializer
from myApp.models import StudentRecord

class StudentSerializers(ModelSerializer):
class Meta:
model = StudentRecord
fields = '__all__'
from rest_framework.viewsets import ModelViewSet
from myApp.models import StudentRecord
from myApp.serializers import StudentSerializers

class StudentView(ModelViewSet):
serializer_class = StudentSerializers
queryset = StudentRecord.objects.all()
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from myApp.views import StudentView

router = DefaultRouter()
router.register('student', StudentView, basename='student')
urlpatterns = [
path('', include(router.urls))




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

6 metrics for HTTP file extraction

15 Best No-Code Tools that you can use to build your next startup

Explained: data governance vs data management

Part 2: Etymology of Variables

Substrate Programming Starter Guide

Setup Google Login in your Cordova/Phonegap App

Retry Mechanism and Delay Queues in Apache Kafka

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Get start Django project, and its files and directories structure

Handle MEDIA files in production — Django

floppy disks and Django media

Implementing a REST API with Django REST framework

An Introduction to GraphQL in Django