Django manager 命令笔记
2024-10-08 14:27:26
1. 新建app
startapp your_app_name
2. 删除app
migrate your_app_name zero
此外还需要删除整个App文件夹,并在settings.py的Installed Apps中移除该app。
3. makemigrations 和 migrate
官方解释如下:
migrate, which is responsible for applying and unapplying migrations.
makemigrations, which is responsible for creating new migrations based on the changes you have made to your models.
(原文链接:https://docs.djangoproject.com/en/2.2/topics/migrations/)
大致的意思为:
- makemigrations是将model层转为迁移文件migration
- migrate将新版本的迁移文件执行,更新数据库。
这两中命令调用默认为全局,即对所有最新更改的model或迁移文件进行操作。如果想对部分app进行操作,就在其后追加app name
4. 创建超级用户
createsuperuser
执行完毕后按照提示输入用户名密码邮箱等信息即可。
最新文章
- PHP的serialize序列化数据与JSON格式化数据
- Configure custom SSL certificate for RDP on Windows Server 2012 in Remote Administration mode
- gulp-less学习教程
- Power of Cryptography
- 【USACO 1.1.1】你的飞碟在这儿
- 解析Xml四种方法
- JFileChooser
- 对Extjs中时间的多种处理
- hibernate简单的增删改查
- python列表很聪明,支持负数索引
- FJUT寒假第一周作业浮点数查寻题解
- 图片纯前端JS压缩的实现
- spring面试问题与答案集锦
- JavaScript 从入门到放弃(二)模块化工具requirejs
- mysql实现简单的增删改查,放入xmapp自带数据库中
- Nodejs之路:非I/O的异步API
- Android精通教程-第一节Android入门简介
- 微信小程序中的组件
- 安卓开发笔记——丰富多彩的TextView
- golang-test-tool-gotests