Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django CommandError: App 'polls' has migrations

Trying to follow the tutorial at Django project.

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

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.

like image 479
sneexz Avatar asked Jun 13 '14 23:06

sneexz


3 Answers

You can either run python manage.py makemigration followed by python manage.py migrate or just delete migrations folder

like image 167
tingyiy Avatar answered Nov 05 '22 08:11

tingyiy


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:

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.

like image 20
alecxe Avatar answered Nov 05 '22 07:11

alecxe


Simply delete folder app-name/migrations.

In Django 1.7 and Python 3.4 the solution I found is to delete this folder and everything works now.

like image 30
Evgeny Palguev Avatar answered Nov 05 '22 07:11

Evgeny Palguev