Removing a django app is easy, remove all imports and usage of the app and also from
INSTALLED_APPS section in
That does remove the app from the project, but not the files and the apps history from the project. The app files will still be in the project and the database will exist in the DB, unless you clone the code to a new machine and migrate, because the migrations of the removed app won't be consider since is removed from
So removing a Django app involves these steps:
- Remove all imports and usage of the app in the project.
- Remove all models in
models.py of the app. Can bring in error if the models are called in other files of the app like
admin.py or any other so remove the reference or just delete the files expect
- Create a new migration for the app, which removes all models.
- Perform Migration.
- Production : If this is to be done in production, perform tests, push the code to production and perform migration before you proceed to next step.
- Remove the app from
- Delete the directory.
This removes the app database and also files, but make sure to remove any packages you used by the app which is not required in project and update the other documentation.
If you have deleted the files before performing the remove migrations, you can drop tables from project database manually depending on your database.