DRF从入门到入土(二)
一、APIView基本使用
使用view+JsonResponse获取所有图书接口
安装drf: pip3 install djangorestframework
settings.py注册app:
'rest_framework' # 注册drf的app,如果不注册,使用浏览器访问会报错,注册成功则会返回一个渲染过得页面,不仅仅是JSON格式数据
models.py
```python
from django.db import models
Create your models here.
class Book(models.Model):