About Removing Obsolete Django Apps
To remove obsolete Django apps, follow these steps:
- Remove foreign keys and many-to-many relations pointing to the models in that app.
- Make migrations.
- Remove all files of the app besides
migrations
,apps.py
, andmodels.py
and references to them. - Empty the
models.py
file. - 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.
- Migrate.
- Deploy to staging, production, and other dev environments.
Finally do some cleanup:
- Remove the app from
INSTALLED_APPS
- 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
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.