Django学习-4-request获取数据
app下views.py
获取前端HTML数据的一些方法
def func(request):
# request.method GET / POST
# request.GET.get('username',None) # 获取请求发来的而数据
# u = request.POST.get("username",None)
# obj = request.FILES.get("file")
# FILE_PATH = os.path.join("uploda", obj.name)
# f = open(FILE_PATH, mode="wb")
# for i in obj.chunks():
# f.write(i)
# f.close()
# return HttpResponse("字符串")
# return render(request, "HTML模板的路径")
# return redirect('/只能填URL')