Introduction to the Python Django Framework Directory Structure in the Computer Graduation Project

The MVC architecture
model model is
used to encapsulate the data related to the business logic of the application and the processing method of the data. It is the data logic part of the web program for processing the application. The model is a functional interface that can be obtained through these interfaces The function of the model.

View
is responsible for the display and presentation of data. View is the direct output of a pair of users. A Mode in MVC usually provides services for multiple Views. In order to obtain real-time update data of the Model, the View should be registered in the Model as soon as possible.

Controller The controller
is responsible for the input from the mobile phone user at the user end, which can be seen as providing the reverse function of View. When the user's input causes the View to change, this change must be reflected in the View through the Model. Under the MVC architecture, the Controller generally cannot communicate directly with the View, which provides the consistency of business data, that is, the Model is the center.

User input is through the Controller, the display is the View, and the Model is the interface between the two parties, as well as data, cache, and files.

MVT architecture
Mangeement management tool:
a set of built-in command tools for creating sites, migrating data, and maintaining static files

Model Mode:
Provides data access interfaces and modules, including the definition and operation of data fields, metadata, data relationships, etc.

View:
Django's view layer encapsulates a series of operations and data flows of HTTP Request and Respose. Its main functions are URL, mapping mechanism, binding template, etc.

Template teample:
A set of Django's own page rendering template language, using several built-in tags and filters to define the way the page is generated.

Form From:
Generate HTML forms through built-in data types and controls.

Management station Admin:
Quickly generate a background data bureau management website through the Model that needs to be managed in life.

Install Django

pip install django

Build Django

django-admin startproject project name

The file
manage.py
is a command line tool used by Django to manage this project, and then site operation, automatic database generation, static file collection, etc. are completed through this file. Management tool

djangosite
directory, project folder, files under the folder.

djangosite / the init .py defined package python

djangosite/setting.py Django project configuration file. By default, it defines the Django components referenced by this project, the project name, configure database parameters, and import other python packages.

djangosite/usrl.py maintains the project's URL routing mapping, that is, defines the URL accessed by the client, which python module interprets and provides feedback.

djangosite/wgsi,py defines the interface information of WSGI and is used to integrate with other web servers. Generally, there is no need to modify the file after it is generated.

Create project application
python manage.py startapp application name

The application directory
admin.py manages the site module declaration file, which is empty by default

The apps.py application information definition file, in which the class AppCongfig is generated, is used to define Meta data such as the application name.

Migrations package: used to later define reference migration data, folder directory

Models.py file to add module layer data class

tests.py test code file.

views.py defines URL corresponding functions

Guess you like

Origin blog.csdn.net/bwwork/article/details/114241462