Django CommandError:应用“轮询"已迁移 [英] Django CommandError: App 'polls' has migrations

查看:39
本文介绍了Django CommandError:应用“轮询"已迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试按照 Django项目中的教程进行操作.

Trying to follow the tutorial at Django project.

我遇到的问题是执行命令时: python manage.py sql polls 我收到了错误消息:

The problem I've come across is that when performing the command: python manage.py sql polls I'm given the error:

CommandError:应用轮询"已迁移.当应用进行迁移时,只能使用sqlmigrate和sqlflush命令

CommandError: App 'polls' has migrations. only the sqlmigrate and sqlflush commands can be used when an app has migrations

到目前为止,我似乎在互联网上或该网站上都找不到该程序的解决方案.

So far I can't seem to find any guide on the internet, or this website for a solution to the program.

推荐答案

问题是您在通过1.6教程时正在使用 Django 1.8 .请注意教程开头的第一句话:

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 the tutorial:

本教程是为Django 1.6和Python 2.x编写的.如果是Django版本不匹配,您可以参考相应版本的教程使用版本切换器右下角的Django版本此页面,或将Django更新到最新版本.

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.

根据您的情况,降级到1.6,或者使用开发教程(当前为1.8)版本.

In your case, either downgrade to 1.6, or use the tutorial for the development (currently 1.8) version.

这篇关于Django CommandError:应用“轮询"已迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆