DjangoORM 执行 python manage.py makemigrations出现 no changes detected
出现 no changes detected
python manage.py makemigrations
No changes detected
为什么出现这种情况:
当执行这条命令,他会去找所有models,在数据库生成表
因为有时候app项目多的时候,他就不知道找哪个models了,不知道在哪个models生成数据库表
这里有models.py

需要要django setting配置文件 这里加上 app项目名字 例如 cmdb
那django就会去cmdb项目下 找models.py 生成数据库
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'cmdb',
]

再执行 python manage.py makemigrations
可以了
python manage.py makemigrations
Migrations for 'cmdb':
cmdb\migrations\0001_initial.py
- Create model UserInfo
生成这个代表成功了

DjangoORM 执行 python manage.py makemigrations出现 no changes detected的更多相关文章
- 执行python manage.py makemigrations时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'
在执行python manage.py makemigrations时报错: TypeError: __init__() missing 1 required positional argument: ...
- Django :执行 python manage.py makemigrations 时报错 TypeError: __init__() missing 1 required positional argument: 'on_delete'
原因 执行命令 python manage.py makemigrations 报错 TypeError: __init__() missing 1 required positional argum ...
- django 执行 python manage.py makemigrations 报错
RuntimeError: Model class app_anme.models.xxx doesn't declare an explicit app_label and isn't in an ...
- 执行: python manage.py makemigrations报AttributeError: 'str' object has no attribute 'decode'
找到错误代码(line146):query = query.encode(errors='replace') 解决方法:把decode改为encode即可.
- Django 中 python manage.py makemigrations 与 python manage.py migrate
执行 python manage.py makemigrations django根据settings.py里面的INSTALLED_APPS项设置找到对应app里的models.py,应用里面创建的 ...
- Django orm 中 python manage.py makemigrations 和 python manage.py migrate 这两条命令用途
生成一个临时文件 python manage.py makemigrations 这时其实是在该app下建立 migrations目录,并记录下你所有的关于modes.py的改动,比如0001_ini ...
- 【Django2.0】python manage.py makemigrations 和 python manage.py migrate的区别
无论当我们第一次在models.py中创建类对象还是对类中的属性进行修改,我们都会使用python manage.py makemigrations 和 python manage.py migrat ...
- 【解决方案】django初始化执行python manage.py migrate命令后,除default数据库之外的其他数据库中的表没有创建出来
[问题原因]:django工程中存在多个应用,每个应用都指定了对应的数据库.执行python manage.py migrate命令时没有指定数据库,将只初始化默认的default数据库. [解决方案 ...
- python manage.py makemigrations生成数据变化的问题
今天遇到的生成数据库的问题django生成数据库的话,使用的是两条命令,一个是python manage.py makemigrations,以及python manage.py migrate在设计 ...
随机推荐
- hdu6134 Battlestation Operational 莫比乌斯第一种形式
/** 题目:hdu6134 Battlestation Operational 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6134 题意:f(n) = ...
- UASCO Wormholes 解析 and C 语言实现
题目大意: 农场有N个洞(2<=N<=12,N为偶数),且组成N/2个连接对.每一个洞的给出平面坐标(x,y). 假设A和B相连,则进入A会从B出来,进入B会从A出来.有仅仅会沿着x轴正方 ...
- js获取textaera对象(object)的值
for(i in pstrWord ){ alert(i); //获得属性 alert(pstrWord[i]); //获得属性值 } 1.js输出object对象方法如下: function wri ...
- tp 批量转码
读取王正东成功,然后把乱码一条一条的改回来... 专门针对mssql数据库的!!!
- sql 更新字段
UPDATE YpeopleSET power='0'WHERE power='1'; UPDATE Ypeople SET power='1' WHERE power='0' and pid='22 ...
- 杂文 - 设计MIUI主题 的 MIUI设计师
设计MIUI主题 的 MIUI设计师 本文地址: http://blog.csdn.net/caroline_wendy 时间: 2014.6.10 By Spike. 1. 首先注冊MIUI设计师: ...
- 辛星和您一起解析PHP中的单例模式
事实上单例模式还是用的挺多的,要说到最经典的样例.可能就是操纵数据库的类了,它假设是单例的话,能够避免大量的new操作消耗资源,而假设系统中须要一个类来管理全局的信息,则把它用成单例也是非常不错的.由 ...
- ThinkPHP项目笔记之登录,注册,安全退出篇
1.先说注册 a.准备好注册页面,register.html,当然一般有,姓名,邮箱,地址等常用的. b."不要相信用户提交的一切数据",安全,安全是第一位的.所以要做判断,客户端 ...
- maven+springmvc错误 JAX-RS (REST Web Services) 2.0 can not be installed
项目problem提示错误 JAX-RS (REST Web Services) 2.0 can not be installed : One or more constraints have not ...
- 【python】matplotlib中文乱码问题
http://www.pythoner.com/200.html 改matplotlibrc文件进入Python安装目录下的Lib\site-packages\matplotlib\mpl-data目 ...