In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use template in django, the content is very detailed, interested friends can refer to, hope to be helpful to you.
The content displayed on the website page is controlled by django template files, and the files related to django templates probably include static resource files such as html5 css js. Django can connect the html file of the template through the view function. Django specifies the associated html file through the render function. When using the template, you need to set the path to the template in settings.py and create a templates folder in the project directory.
The first parameter of the render function is default, which is request, and the second parameter is the path of the html file, which starts with the templates folder. Of course, the template can also accept the parameters passed by the view function, which can be passed to the html5 file through context. For example:
Write a simple login function, just submit what the user typed, and use the form to initiate a POST request.
Form is the html syntax, which means to use a form, and method= "post" means to use the form to initiate an POST request. Input is the meaning of the input box, there are many types, text is plain text, password password type, the content entered by the user is non-plaintext.
The above view function has two major functions. When the request method is GET, the input box for login is displayed. When the submit button is clicked, that is, when the request is POST, get the content of the request and get the user name and password.
The user logs in and sends the content filled in the page form to the background to obtain the data. Django obtains the data submitted by post in the view function through the request.POST method.
On how to use template in django to share here, I hope the above content can be of some help to 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.