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.
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:In your case, either downgrade to 1.6, or use the tutorial for the development (currently 1.8) version.
You can either run
python manage.py makemigration
followed bypython manage.py migrate
or just delete migrations folderWith django 1.7, instead of deleting app-name/migrations folder, In your MIGRATION_MODULES entry of your site, you can rename the application dictionary value with an non-existing module name by adding some dummy string:
MIGRATION_MODULES['my_app'] += '_xx'
And then manage.py sqlclear my_app works fine.
In Django 1.8, you should run another command--makemigrations [your app name]:
You should see something similar to the following:
Simply delete folder
app-name/migrations
.In
Django 1.7
andPython 3.4
the solution I found is to delete this folder and everything works now.