django no such table:
Updated answer for Django migrations without south
plugin:
Like T.T suggested in his answer, my previous answer was for south
migration plugin, when Django hasn't any schema migration features.
Now (works in Django 1.9+):
T.T wrote:
You can try this!
python manage.py makemigrations python manage.py migrate --run-syncdb
Outdated for south
migrations plugin
As I can see you done it all in wrong order, to fix it up your should complete this checklist (I assume you can't delete sqlite3 database file to start over):
- Grab any SQLite GUI tool (i.e. http://sqliteadmin.orbmu2k.de/)
- Change your model definition to match database definition (best approach is to comment new fields)
- Delete
migrations
folder in your model- Delete rows in
south_migrationhistory
table whereapp_name
match your application name (probablyhomework
)- Invoke:
./manage.py schemamigration <app_name> --initial
- Create tables by
./manage.py migrate <app_name> --fake
(--fake
will skip SQL execute because table already exists in your database)- Make changes to your app's model
- Invoke
./manage.py schemamigration <app_name> --auto
- Then apply changes to database:
./manage.py migrate <app_name>
Steps 7,8,9 repeat whenever your model needs any changes.
You can try this!
python manage.py migrate --run-syncdb
I have the same problem with Django 1.9 and 1.10. This code works!