About Removing Obsolete Django Apps

To remove obsolete Django apps, follow these steps:

  1. Remove foreign keys and many-to-many relations pointing to the models in that app.
  2. Make migrations.
  3. Remove all files of the app besides migrations, apps.py, and models.py and references to them.
  4. Empty the models.py file.
  5. Make migrations to create migrations removing the models from this app. In the dependencies, list all the migrations which were removing the relations pointing to the models of this app.
  6. Migrate.
  7. Deploy to staging, production, and other dev environments.

Finally do some cleanup:

  1. Remove the app from INSTALLED_APPS
  2. Remove all cross-references of migrations in other apps pointing to this app.

Tips and Tricks Programming Development Databases Django 4.2 Django 3.2 Django 2.2