您的位置:首页 > 移动开发

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
Django 1.8
while 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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: