Home > Article > Backend Development > Introduction to django2 routing configuration and rendering methods (pictures and text)
This article brings you an introduction (pictures and text) about django2 routing configuration and rendering methods. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
<<
(1) First register the created app
(2) Configure routing
Create a new urls.py module in the app directory
Copy the contents of urls.py in the myproject directory into the module, and Import the view function
(3) Write the view function
Upload and run the project and access it in the browser
##[urls->View function->Front-end view]<<##Access 127.0.0.1:8000/myapp/login
Press Enter to enter the following page
##<<>>
(1) First create a folder with a fixed name templates in the project root directory, and create a folder with the same name as the app under the file (for ease of maintenance when the number of apps increases) for storage TemplateThe following is the template content
(2) Configure the path of the template in settings.py, Django will automatically search for templates from this path
BASE_DIR is the project root directory
(3) Introduce the template into the view function
(4)Visit
The above is the detailed content of Introduction to django2 routing configuration and rendering methods (pictures and text). For more information, please follow other related articles on the PHP Chinese website!