I'm using south to migrate schemes to production. Also I'm using the django-sitetree module to show the menu in my site.
There is no problem with schema migration by using commands:
./manage.py schemamigration myApp --freeze sitetree --auto
./manage.py migrate myApp
However when I'm trying to migrate the sitetree data by command:
./manage.py datamigration myApp "new_version" --freeze sitetree
it doesn't generate any of created sitetree elements.
Ok, after some research and thanks to this sources: Altering database tables in Django and Fixtures and initial data blog, it seems that the better way to pass the menu data by using initial_data.json file with fixtures.
Create "fixtures" folder inside your App folder.
Run
./manage.py dumpdata --format=json --indent=4 sitetree > APP_PATH/fixtures/initial_data.json
You can add more app to the command if you wish their data to be migrated to other environments.The saved data to
fixtures/initial_data.json
will be always inserted/replaced by running./manage.py syncdb
Remember that the data will be replaced if it already exists in DB, it means that you should not dump the dynamic data.There is the other way to migrate the sitetree using sitetree management command
Thank you to idle-sign for this link