Patrick Bassut
Patrick Bassut

Reputation: 3338

Change the location of models.py with south

I just changed the location of models.py to another app's directory. And now when using south to make the migration, it says:

D:\logos-education-system>manage.py schemamigration core --auto
You cannot use automatic detection, since the previous migration does not have t
his whole app frozen.
Either make migrations using '--freeze core' or set 'SOUTH_AUTO_FREEZE_APP = Tru
e' in your settings.py.

D:\logos-education-system>

Somehow, South can't relate the models.py(in a new folder) with the data already in the database and continue from there.

So, my question is: How do I make south forget about the old folder where models.py were in and use the new folder in such a way that south thinks was always there?

Thanks in advance.

Upvotes: 3

Views: 817

Answers (1)

Patrick Bassut
Patrick Bassut

Reputation: 3338

With a couple of steps, I did it.

  1. First I changed the south migration table manually to set app_name to the new app_name

  2. then I went across all the current migrations .py files and changes all the ocurrencies of the old folder to the new one.

  3. Also, still in the .py migration files, I made sure that all complete_apps = ['OLD_APP_NAME'] was changed to complete_apps = ['NEW_APP_NAME'] as well.

  4. Ran the schemamigration normally like the models.py has always been there.

Upvotes: 5

Related Questions