In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to achieve request response in django, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
A middleware needs to be commented in the setting.py file, otherwise a 403 error will be reported and will be explained later.
Ok, let's get started.
View the first page of information and display 20 pieces of information on one page.
GET / app01/students/?page_no=1&page_rows=20
Check the student information that id is 1BI 2 and 3.
GET / app01/students/?id=1&id=2&id=3
Url's? Followed by the request parameters, & is the parameter splicing, if a request parameter is a list, you can use the
In the form of param=1¶m=2¶m=3
You can get the request information from request. When the request is a GET request, you can get the request parameter information through request.GET. The data type is a dict, and request.method is the way to get the current request. When the request method is not a GET request, you can obtain the parameter information of the request through request.POST.
Add a new student, whose name is Xiaoming, age 25
POST / app01/students/
Parameters are passed in form-data mode when sending a post request using postman. The content obtained by request.POST is still of the type of dict.
Modify a student information
PUT / app01/student/1/
Delete a student
DELETE / app01/student/1/
Because Django does not have a dictionary structure for PUT DELETE requests like POST GET does. We need to manually process the request.body to get the parameters, and then json to format the obtained parameters again.
On how to achieve request response in django to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.