02. 脚手架基本的开发流程

58 字约 1 分钟读完100 次阅读更新于 2026/5/3

开发流程

数据库

CREATE TABLE `book` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称',
  `img` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '图片',
  `author` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '作者',
  `price` double DEFAULT NULL COMMENT '价格',
  `publisher` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '出版社',
  `publishtime` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '出版时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='图书信息';

后端接口

开发 model

class Book(models.Model):
    """图书信息"""
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255, null=True, blank=True)
    img = models.CharField(max_length=255, null=True, blank=True)
    author = models.CharField(max_length=255, null=True, blank=True)
    price = models.FloatField(max_length=10, null=True, blank=True)
    publisher = models.FloatField(max_length=255, null=True, blank=True)
    publishtime = models.FloatField(max_length=255, null=True, blank=True)

    class Meta:
        db_table = 'book'

开发 api,配置 api

配置 api init.py

from .book_api import router as book_router

api.add_router("/book", book_router, tags=["图书信息模块"])

前端

开发 vue3 页面 配置路由和菜单