Using south
- setup the model
python manage.py schemamigration models --initial
- dump data if you have to
python manage.py dumpdata -e contenttypes -e auth.Permission --natural > data.json
- syncdb
python manage.py syncdb
python manage.py migrate models
- load the data back into the db
python manage.py loaddata data.json
- Afterwards, you may use
python manage.py schemamigration models --auto
python manage.py migrate models
after every change you made in the models schema
A few notes
- Unloading the database and reload it is essential, because if not doing so the first migration will tell you already have those models.
- The -e contenttypes -e auth.Permission --natural parameter in dumpdata is essential otherwise exception will be thrown when doing loaddata.