Go to: Correct Django South usage

Source: Internet
Author: User
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.

Related Article
Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.