django3学习笔记一
django开发
主题:员工管理系统
1.创建项目和app

创建app并注册
python
python manage.py startapp app01
注册
2.设计表结构
3.在MySQL中生成表
orm只能生成类不能生成数据库
- 工具连接MySQL生成数据库
python
create database test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
- 修改配置文件,连接MySQL

- django命令生成数据库表
python
python manage.py makemigrations
python manage.py migrate
表结构创建成功
4.静态文件管理
static目录
5.部门管理
5.1部门列表
- 去数据库中获取所有的部门列表
点击跳转到添加页面



添加页面

删除列表
编辑列表



6.模板的继承
定义模板:'layout.html'
继承模板: