web.py templates are easy to use, but sometimes we need to do directory hierarchies to manage. So how do you use directory-level templates?
Usually when we use a template, we declare the template folder first.
Copy Code code as follows:
Render=web.template.render (' Templates ')
Use the Templates folder to index.html the template
Copy Code code as follows:
Use the Templates folder to list.html the template
Copy Code code as follows:
All of the above HTML template files are placed in the Tempates directory only, if you want to build a directory under Templates and use the template files in the directory only add directory name.
Use the index.html template in the admin directory under templates
Copy Code code as follows:
Return Render.admin.index ()
Use the login.html template in the admin directory under templates
Copy Code code as follows:
Return Render.admin.login ()