Home > php教程 > php手册 > django入门记录 2,django入门记录

django入门记录 2,django入门记录

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 08:42:27
Original
997 people have browsed it

django入门记录 2,django入门记录

1. 创建一个app, python manage.py startapp  appname

2. 设计model,在appname/目录下编辑好model

3. 检测model的修改,python manage.py makemigrations appname

4. 自动执行数据库迁移,并同步管理数据库结构, python manage.py sqlmigrate 0001

5. 在数据库中创建新定义的模型的数据表 python manage.py migrate

 

改变模型的步骤:

  • 编辑 models.py 文件,改变模型。
  • 运行 python manage.py makemigrations 为模型的改变生成迁移文件。
  • 运行 python manage.py migrate 来应用数据库迁移。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template