This is the 16th day of my participation in Gwen Challenge
What is a software framework
To take a simple example, for a company, there are various functional departments in the company. Each department performs its own duties and completes its work through cooperation among departments. These departments form the organizational structure of a company. In a sense, a company is a framework. Then corresponding to software design, software framework is composed of various modules, each module is responsible for specific functions, modules and modules cooperate with each other to complete software development.
A company is established for a certain market, and the design of software framework is also designed for a certain kind of software problem, its purpose is mainly to improve the efficiency of software development.
Introduction of the MVC
Model-view-controller, the full name of MVC, was first proposed by TrygveReenskaug in 1978. It is a software design mode invented by Xerox PARC in 1980s for Smalltalk, a programming language. It is designed to apply the traditional input, processing and output tasks into the graphical user interaction model. With the advent of standard I/O devices, developers need only focus on the analysis and implementation of business logic. It has since been recommended as a design pattern for Oracle’s Sun Java EE platform and is increasingly popular with developers using ColdFusion and PHP. Although the original way of division of labor is no longer used, the idea of division of labor has been used and widely used in software engineering, which is a typical and widely used software architecture mode. Later, MVC ideas were applied to Web development, known as the Web MVC framework.
MVC concept: division of labor, let specialized people do specialized things.
The core idea of MVC framework is: decoupling, reducing the coupling between different code blocks, enhancing the extensibility and portability of code, and realizing backward compatibility.
For example: King of Glory division
The functionality of various parts of Web MVC
M is Model, which mainly encapsulates the access to the database layer and adds, deletes, changes, and searches data in the database.
V full spell is View, which is used to encapsulate the result and generate THE HTML content displayed on the page.
C, spelled Controller, is used to receive requests, process business logic, interact with Model and View, and return results.
Django profile
Django, pronounced ‘djangos’, is an open source Web development framework written in Python that follows an MVC design. The framework was developed by Lawrence Publishing Group to develop news-focused websites and released under the BSD license in July 2005. The name comes from the Belgian jazz musician DjangoReinhardt, who was a gypsy who played mainly the guitar and also the violin. Due to the rapid development of Django in recent years, more and more widely used, IT was selected by SDTimes 2013 SDTimes 100, ranked 6th in the category of “API, Library and Framework “, is considered to be the leader in this field. The main purpose of Django is to make it easy and fast to develop database-driven websites. There is a strong emphasis on code reuse. Multiple components can easily serve as “plug-ins” to the framework. Django has many powerful third-party plugins, and you can even easily develop your own toolkit. This makes Django very extensible.
It also emphasizes rapid development and DRY principles
Do not Repeat Yourself
Django source https://github.com/django/django
Django’s official website https://www.djangoproject.com/
Django 3.1 https://docs.djangoproject.com/zh-hans/3.1/ official document in Chinese
The Django framework follows an MVC design and has a name for it: MVT
The functions of various parts of the MVT
M is Model, which has the same function as M in MVC. It is responsible for interaction with database and data processing.
V stands for View, which has the same function as C in MVC. It receives requests, performs business processing, and returns responses.
T is fully spelled as Template, which has the same function as V in MVC and is responsible for encapsulating and constructing the HTML to be returned.
- The difference is the black line marked by the black arrow
The public,
Create a new folder X
Nature took tens of billions of years to create our real world, while programmers took hundreds of years to create a completely different virtual world. We knock out brick by brick with a keyboard and build everything with our brains. People see 1000 as authority. We defend 1024. We are not keyboard warriors, we are just extraordinary builders of ordinary world.