Django学习-4-request获取数据

app下views.py
            获取前端HTML数据的一些方法
            def func(request):
                # request.method   GET / POST
                
                # http://127.0.0.1:8009/home?nid=123&name=cqcq
                # 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')
posted @ 2017-11-08 21:13  前路~  阅读(615)  评论(0编辑  收藏  举报