I. Introduction of ORM
Mapping relations:
Name of table
Attributes of fields
Table record – — class instantiated object
ORMThe two major functions are:
Operating table:
- Create a table
- Modified table
- Delete table
Operation data row:
- crud
ORMLink database with pymysql third party tools
DjangoThere is no way to help us create the database. We can only tell it after we have created it, and let Django link it.
Two. Preparation before creating the table.
First, create your own database.
Two, configure MySQL database link in settings
sqlite3——Change to MySQL
Four, create database tables
models.py
Specific examples to achieve
model.py
urls.py
views.py
template /index.html