Django framework - Advanced tutorial process created Django project

1. Django Introduction

There are many different models of Web framework Python. Django is a heavyweight in the most representative one. Many successful website and APP are based on Django.

Django Web application framework is an open source, written in Python.

Django BSD copyright compliance, first released in July 2005, and released the first official version 1.0 in September 2008.

 

2. MVC framework and MTV framework

2.1 MVC framework

  MVC framework, full name angle Model View Controller, an architectural model of software engineering, this model system, the software is divided into three parts: model (the Model), view (View) and a controller (Controller). This mode: coupling having a low, high reusability, and low life-cycle cost. Other software design patterns: please point me !

 

 

   Django MVC framework draws on ideas that he designed a framework for thinking MTV. It differs Django framework is that it is divided into three parts: Model (model), Template (templates) and View (View), i.e. MTV frame.

2.1 Django framework of MTV

  Model (model): Responsible for business objects and database objects (ORM)

       Template (template): responsible for how the page displayed to the user

       View (View): is responsible for the business logic, and calls the Model and Template at the appropriate time

In addition, Django urls as well as a distributor, it is the role of a URL of a page view requests distributed to different treatment, and then call the appropriate view of Model and Template.

  MTV framework architecture diagram

 

 

 

3. APP concept

Description: The purpose of Django APP are: feature allows project in different projects of independent open. APP here that is not installed on your phone but that APP django project for the smallest unit of function division, a project completed by the integration of multiple APP, APP each relatively independent, improve development efficiency is also convenient feature to migrate, to avoid duplication made wheels . Django encourages developers to be relatively independent of project development.

3.1 Creating APP

The method creates APP: Click the "  Create a Django project process  ."

4. Django explain the MTV

4.1 T template system (Template)

Please point me to learn template system >>>

4.2 V routing system (the urls.py) and a view of the system (the views.py)

Routing System (urls.py): Routing System study please point me >>>

View of the system (views.py): Please point me to learn the system view >>>

4.3 M model system (model system)

Please point me to learn the system model >>>

 

Guess you like

Origin www.cnblogs.com/mashangsir/p/11432763.html