视图层函数必须要返回一个HttpResponse对象。
视图层的三板斧:(三板斧本质上也是HttpResponse对象)
from django.shortcuts import HttpResponse, render, redirect
from django.http import JsonResponse
读取文件和写入文件
file_obj = request.Files.get(‘ xxxx ‘),此处的xxx对应前端form表单中input上传文件中的name。
file_name = file_obj.name
顶
CSIC_716_2020107【Django入门---视图层JsonResponse】
原文:https://www.cnblogs.com/csic716/p/12158450.html