Solutions from stackoverflow user Ken kroke and others
Someone asked the above question on stackoverflow, and Ken gave a very nice detailed answer. He proposed the correct method of using South in different situations, as follows:
1) when creating a new project without a database
1. Create a database
2. Add south to installed_apps
3. Run the syncdb command to add data tables of Django and south to the database.
4. Add the apps you created to installed_apps
5. Run"Python manage. py schemamigration app_name -- Initial"It will create the migration directory and corresponding files under each app directory
6. Run"Python manage. py migrate app_nameThis step adds the APP data table to the database.
2) Use South in existing projects with databases
1. Add south to installed_apps
2. Run syncdb to add the South data table to the database.
3. run each app separatelyPython manage. py schemamigration app_name -- InitialIt will create the migration directory and corresponding files under each app directory
4. Run"Python manage. py migrate app_name 0001 -- fake", This command does not perform any operations on the database. It just deceives south to add some records to the south_migrationhistory table so that everything can be done the next time you want to create the migration file.
3. Use South in projects without Databases
1) Create a database
2) add South to installed_apps
3) Run"Python manage. py schemamigration app_name -- InitialIt will create the migration directory and corresponding files under each app directory.
4) Run syncdb, which adds all apps without migrations to the database.
5) then run"Python manage. py migrate"Command, it will run the migration operation on all your apps.
The answer to Ken is not detailed. If you still have questions, you can click the link below to go to stackoverflow to see his original text and others' answers: Click me to go.