db first 根据现有数据库的数据表结构生成相应的模型对象,使用python manage.py inspectdb指令即可生成模型对象的定义过程。code first是编写模型对象的定义过程,由模型对象创建相应的数据表,依次执行makemigrations和migrate指令即可。