如何将请求(模块名称)数据参数发送到我的 dJango 服务器?
how can I get requests(module name) data parameter to my dJango server?
我的 tkinter 应用程序
def _calculation(self):
myList = [1,2,3,4,5]
url = "http://127.0.0.1:8000/test"
response = requests.post(url, data=json.dumps(myList))
我的 dJango 服务器
@csrf_exempt
def test(request):
print(request.data) # why error happen?
return HttpResponse('')
我正在做一个 tkinter 应用程序(前面)和 django 服务器(后面)post 匹配,但我无法从 django 服务器获取请求(模块名称)数据(请求参数)。如何获取请求数据参数
AttributeError: 'WSGIRequest' 对象没有属性 'data'
但你可以像这样使用 request.body
:
@csrf_exempt
def test(request):
print(request.body)
return HttpResponse('')
我的 tkinter 应用程序
def _calculation(self):
myList = [1,2,3,4,5]
url = "http://127.0.0.1:8000/test"
response = requests.post(url, data=json.dumps(myList))
我的 dJango 服务器
@csrf_exempt
def test(request):
print(request.data) # why error happen?
return HttpResponse('')
我正在做一个 tkinter 应用程序(前面)和 django 服务器(后面)post 匹配,但我无法从 django 服务器获取请求(模块名称)数据(请求参数)。如何获取请求数据参数
AttributeError: 'WSGIRequest' 对象没有属性 'data'
但你可以像这样使用 request.body
:
@csrf_exempt
def test(request):
print(request.body)
return HttpResponse('')