Zero-based learning Python|Python framework Django learning (2)-django detailed explanation

Author's homepage: Programming Thousand Paper Cranes

About the author: Java, front-end, and Python have been developed for many years, and have worked as a senior engineer, project manager, and architect

Main content: Java project development, graduation design development, interview technology arrangement, latest technology sharing

Favorites, likes, don't get lost, it's good to follow the author

Get the source code at the end of the article

Second, Django detailed explanation

2.1 Templates and static files

2.1.1 Basic page access steps

From the above introductory case, it can be obtained that there are three fixed steps to develop web resources:

1. Define html pages in templates

2. Define the requested function interface in views.py

3. Define the route mapping access path function address in urls.py

For example, if I want to display a news page, here's how to do it:

1. Define the news.html page in templates

 <!DOCTYPE html>
 <html lang="en">
 <head>
     <meta charset="UTF-8">
     <title>新闻列表页面</title>
 </head>
 <body>
 显示新闻信息
 </body>
 </html>

2. Define the access interface function in views.py

Guess you like

Origin blog.csdn.net/BS009/article/details/131293746