'' ' ORM Import pymysql pymysql.connect ( ... ... ) 1. different programmers write SQL uneven level 2. The efficiency is also uneven python syntax - automatic translation -> SQL statements jQuery the DOM $ ( "# d1") - automatic translation -> document.getElementById ( "d1") ORM: advantages: 1. simple, do not write your own SQL statements 2. development of high efficiency disadvantages: 1. you remember this special syntax 2 with respect to some of the great God SQL statements, certainly the efficiency gap correspondence between the ORM: class ---> data table objects ---> data line properties ---> field ORM thing to do: 1. operating data table -> create table / delete tables / modify table operation models.py inside the class 2. operation data lines -> additions and deletions to change search data can not create the database, create the database yourself ORM detailed steps to use Django's: 1 . create the database yourself create database database name; 2. Set the database connection configuration Django projects (to tell which one is connected Django database) # database relevant configuration DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql ', database connection type # ' HOST ':' 127.0.0.1 ', connected to the address database # ' pORT ': 3306, # ports ' nAME': "baidu", # database name 'USER': 'root', # users 'pASSWORD': 'root' # password } } 3. tell Django with pymysql instead of the default MySQLDB connect to the MySQL database in the project / __init__.py file, write the following two: Import pymysql # pymysql tell Django to use instead of the default MySQLdb pymysql.install_as_MySQLdb () 4. define a class in the following models.py app file, this class must inherit models.Model class class name (models.Model): ... The two command execution 1.python3 manage.py makemigrationspy makemigrations 2.python3 manage.py migrate Increase ORM and single-table queries :( delete, annotate only correspondence between the models is generated in the implementation of the migration, the migration) 1. Query models.UserInfo.objects.all () 2. increase models.UserInfo.objects.create (name = "John Doe") ''