I have just begun learning the Django framework, and my goal is too take this knowledge and use it to build a rest api. (I have considered using django-rest framework, but my job requires specifically Django). I have already learned a medium amount of nodejs, and for this I use express. I use the req.body to enable users to enter some information. In Django, how would I use this req.body property to allow a user to type information. This is purely for backend purposes (no frontend included). For example, sending a post request, and setting parameters.
Both Express and Django endpoints receive a reference to the request object. The APIs are of course different. Here is a rough mapping:
https://example.com/?foo=bar
):
foo=bar
):
request.method
, which is a string like "POST"
or "GET"
. request.body
in express is equivalent to
request.POST
in django
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.