CommandError: App 'books' has migrations
2015-08-14 17:56
691 查看
执行python manage.py sql polls时出现错误
?
处理:
删除migrations目录或者执行manage.py migrate
参考:http://stackoverflow.com/questions/24215005/django-commanderror-app-polls-has-migrations
------------------------------------------------------------------------------------------------------
The problem is that you are using
This tutorial is written for Django 1.6 and Python 2.x. If the Django version doesn’t match, you can refer to the tutorial for your version of Django by using the version switcher at the bottom right corner of this page, or update Django to the newest version.
In your case, either downgrade to 1.6, or use the
tutorial for the development (currently 1.8) version.(https://docs.djangoproject.com/en/dev/intro/tutorial02/)
--------------------------------------------------------------------------------------------------------
删除books目录下的migrations文件夹后成功,结果如下:
[root@localhost mysite]# python manage.py sqlall books
BEGIN;
CREATE TABLE `books_publisher` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(30) NOT NULL,
`address` varchar(100) NOT NULL,
`city` varchar(50) NOT NULL,
`state_province` varchar(50) NOT NULL,
`county` varchar(30) NOT NULL,
`web` varchar(200) NOT NULL
)
;
CREATE TABLE `books_author` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`email` varchar(254) NOT NULL
)
;
CREATE TABLE `books_books` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(30) NOT NULL,
`author` varchar(30) NOT NULL,
`publisher` varchar(50) NOT NULL,
`publish_date` date NOT NULL
)
;
COMMIT;
?
删除migrations目录或者执行manage.py migrate
参考:http://stackoverflow.com/questions/24215005/django-commanderror-app-polls-has-migrations
------------------------------------------------------------------------------------------------------
The problem is that you are using
Django 1.8while going through 1.6 tutorial. Pay attention to the first words at the beginning of thetutorial:
This tutorial is written for Django 1.6 and Python 2.x. If the Django version doesn’t match, you can refer to the tutorial for your version of Django by using the version switcher at the bottom right corner of this page, or update Django to the newest version.
In your case, either downgrade to 1.6, or use the
tutorial for the development (currently 1.8) version.(https://docs.djangoproject.com/en/dev/intro/tutorial02/)
--------------------------------------------------------------------------------------------------------
删除books目录下的migrations文件夹后成功,结果如下:
[root@localhost mysite]# python manage.py sqlall books
BEGIN;
CREATE TABLE `books_publisher` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(30) NOT NULL,
`address` varchar(100) NOT NULL,
`city` varchar(50) NOT NULL,
`state_province` varchar(50) NOT NULL,
`county` varchar(30) NOT NULL,
`web` varchar(200) NOT NULL
)
;
CREATE TABLE `books_author` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`email` varchar(254) NOT NULL
)
;
CREATE TABLE `books_books` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`title` varchar(30) NOT NULL,
`author` varchar(30) NOT NULL,
`publisher` varchar(50) NOT NULL,
`publish_date` date NOT NULL
)
;
COMMIT;
相关文章推荐
- GitHub 优秀的 Android 开源项目
- iOS NSString 为什么要使用copy,而不是retain?
- android绘制矩形框-不要描边
- unity, iOS集成微信
- (4.1.32.1)Android闹钟 AlarmManager的使用
- Objective-C 循环引用的处理
- Android之指南针学习
- Android中的关于MDM中的几个方法举例
- Objective-C #include、#import 、 @class的使用区别
- android测试之getevent/sendevent
- Android开发中Bitmap和Drawable的区别
- Android性能优化典范(三)
- Android广播机制(1)
- iOS XCode启用/关闭Clang Warnings
- Android物流跟踪
- Android中父View和子view的点击事件
- Android:EditText 多行显示及所有属性
- iOS小白进阶之旅(二)
- Android:EditText 多行显示
- 适应多行长文本的Android TextView