postman实现对数据库的增删改查
1.安装postman
[官方网站](https://www.getpostman.com/apps)下载安装包,默认安装即可
打开桌面快捷方式,先注册,我的账号jack_apple, 绑定的邮箱:@126.com
2.虚拟环境下,在项目中安装工具:
pip install djangorestframework
pip install django-filter
3.settings.py文件中INSTALLED_APPS中:
加入rest_framework
4.在stu下的urls.py文件中写个url,如下:
from rest_framework.routers import SimpleRouter
# 创建路由
router = SimpleRouter()
# 给路由绑定一个url 此处student后面一定不要加/,
否则找不到页面 貌似访问时自动加 /
router.register(r'student', views.StudentEdit)
# django 默认到urlpatterns中查找url, 故把次路由加到urlpatterns
urlpatterns += router.urls
5.在stu下新建一个serializers.py的文件,里面书写程序如下:
from rest_framework import serializers
# stu下的models.py文件下写的有个Student的模型
from stu.models import Student
class StudentSerializer(seri