This is bugfix that allow to run Tenant.save several times in one process.

In fact this is bug fix for 3 different bugs that disallow to create many Tenant schemas in one process, for example celery worker.

First bug occure when after migrating SOUTH_MIGRATION_MODULES is set to None, then next execution crash south, as it check only if settings hasattr, and not if it's proper dict.

Second bug is bug in south itself, they monkeypatch django AppCache get_apps method, but it seems it's singleton object which methods must be properly restored. This was the hardest one to find.

Third bug is only in projects with migrations dependencies, caching is clearing to much or to less and dependencies aren't computed after cleaning south migrations cache.