博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Django学习中遇到的问题(1)django migration No migrations to apply
阅读量:5959 次
发布时间:2019-06-19

本文共 1913 字,大约阅读时间需要 6 分钟。

C:\Users\Desktop\homeWork\Django_stu_man>python manage.py makemigrationsMigrations for 'app01':  app01\migrations\0001_initial.py    - Create model ClassList    - Create model Course    - Create model CourseRecord    - Create model Customer    - Create model CustomerFollowRecord    - Create model School    - Create model StudyRecord    - Create model UserProfile    - Add field follower to customerfollowrecord    - Add field consultant to customer    - Add field course to customer    - Add field referral_form to customer    - Add field teacher to courserecord    - Add field course to classlist    - Add field teachers to classlist    - Alter unique_together for courserecord (1 constraint(s))    - Alter unique_together for classlist (1 constraint(s))C:\Users\Desktop\homeWork\Django_stu_man>python manage.py migrateOperations to perform:  Apply all migrations: admin, app01, auth, contenttypes, sessionsRunning migrations:  No migrations to apply.

如上所示,建完表之后,运行python manage.py migrate,总是No migrations to apply,数据库中表也没有建成。

通过查阅资料,大部分建议都是先运行python manage.py makemigrations,再运行python manage.py migrate,然并卵。

最后在stackoverflow上发现了正解。

 

Django keeps track of all the applied migrations in django_migrations table. So just delete all the rows in the django_migrations table that are related to you app like:

DELETE FROM django_migrations WHERE app='your-app-name';

and then do:

python manage.py makemigrationspython manage.py migrate

 

C:\Users\Desktop\homeWork\Django_stu_man>python manage.py makemigrationsNo changes detectedC:\Users\Desktop\homeWork\Django_stu_man>python manage.py migrateOperations to perform:  Apply all migrations: admin, app01, auth, contenttypes, sessionsRunning migrations:  Applying app01.0001_initial... OK

 

binggo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

https://stackoverflow.com/questions/33549772/django-migration-no-migrations-to-apply

转载于:https://www.cnblogs.com/william126/p/7591562.html

你可能感兴趣的文章
ftp网络服务的搭建和配置
查看>>
强化管理远程分支机构利器之coreRODC[为企业部署Windows Server 2008系列九]
查看>>
管理Windows Server Core服务器共享文件夹
查看>>
搭建MongoDB主从复制(Master-Slave)
查看>>
net类库中发送电子邮件的方法总结
查看>>
Mybatis like查询的写法
查看>>
寻找泄漏源 密封企业敏感数据
查看>>
Jigloo 开发 SWT 的入门教程
查看>>
HTML5 学习(1) -- 介绍
查看>>
SQL 必知必会·笔记<17>使用存储过程
查看>>
Linux上的SCWS安装与使用(包括PHP扩展)
查看>>
spark rdd saveAsTextFile保存为文件
查看>>
ArcGIS “Error HRESULT E_FAIL has been returned from a call to a COM component.” 异常的解决
查看>>
NeHe OpenGL教程 第十七课:2D图像文字
查看>>
.NET开源项目(转)
查看>>
补码[基础]
查看>>
两个乒乓球队进行比赛问题
查看>>
POJ2709 Painter 贪心算法
查看>>
oc-10-对象做参数
查看>>
Windows Azure Cloud Service (10) Role的生命周期
查看>>