0x01 环境搭建

1、筹备

sudo pip3 install -U pippip install djangopip install ipython mysqlclient

2、创立我的项目

django-admin startproject myProject  //创立我的项目cd myProjectpython3 manage.py startapp myApp  //创立利用

3、启动

python3 manage.py runserver 0:8080

4、根本目录构造

myProject├── db.sqlite3├── manage.py├── myApp│   ├── admin.py│   ├── apps.py│   ├── __init__.py│   ├── migrations│   │   ├── 0001_initial.py│   │   ├── __init__.py│   │   └── __pycache__│   │       ├── 0001_initial.cpython-35.pyc│   │       └── __init__.cpython-35.pyc│   ├── models.py│   ├── __pycache__│   │   ├── admin.cpython-35.pyc│   │   ├── apps.cpython-35.pyc│   │   ├── __init__.cpython-35.pyc│   │   ├── models.cpython-35.pyc│   │   └── views.cpython-35.pyc│   ├── templates│   │   └── myApp│   │       └── detail.html│   ├── tests.py│   └── views.py└── myProject    ├── __init__.py    ├── __pycache__    │   ├── __init__.cpython-35.pyc    │   ├── settings.cpython-35.pyc    │   ├── urls.cpython-35.pyc    │   └── wsgi.cpython-35.pyc    ├── settings.py    ├── urls.py    └── wsgi.py

5、其余

  • 应用ipython接口

python3 manage.py makemigrations myApp

  • 在models里进行了数据库的批改当前
python3 manage.py makemigrations myApppython3 manage.py sqlmigrate myApp 0001python3 manage.py migrate

0x02 实战我的项目

1、booklist
知识点:数据库操作

参考资料:
https://www.lanqiao.cn/course...