
URL 匹配
1 |
from django.urls import path, re_path, include |
参数传递
- URL匹配中带参数的,直接在参数中
- URL中仅匹配头部,其他参数
?之后的,无论客户端发起何种HTTP请求,参数在URL中,都在request.GET.kwargs中获取 - 其他在参数在请求体中的,request.POST或request.body中获取,两者差别
1
2HttpRequest.body
The raw HTTP request body as a byte string. This is useful for processing data in different ways than conventional HTML forms: binary images, XML payload etc. For processing conventional form data, use HttpRequest.POST.




近期评论