Django 2 Web Development Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

Execute the following steps:

  1. Migrate all of your apps to the latest South migrations, as follows:
(myproject_env)$ python3 manage.py migrate

Remove south from INSTALLED_APPS, in the settings.

  1. For each app with South migrations, delete the migration files and leave only the migrations directories.
  2. Create new migration files with the following command:
(my_project)$ python3 manage.py makemigrations
  1. Fake the initial Django migrations, as the database schema has already been set correctly:
(my_project)$ python3 manage.py migrate --fake-initial
  1. If there are any circular relationships in the installed apps (that is, two models in different apps pointing to each other with a foreign key or many-to-many relation), apply the fake initial migrations to each of these apps separately, as follows:
(my_project)$ python3 manage.py migrate --fake-initial demo_app