How to uninstall a Django App

Django applications are easy to install, but they take a little bit of work to uninstall. Here's how to remove all database tables & records and clean up all traces left in your Django project.

Step 1 - Removing Django app database records and tables

Since Django 1.7 and the built-in migration system, it has been very easy to clean up an app's models. Simply run the following command in your console:


python manage.py migrate app_name zero

Step 2 - Cleaning up Django Content Types

If you see django.contrib.contenttypes in your settings.py INSTALLED_APPS list, you will need to clean up these records. Here's the Django management command for removing stale content types:


python manage.py remove_stale_contenttypes

Step 3 - Remove App from settings.py and urls.py

Remove the app from your settings.py INSTALLED_APPS list and from your base project urls.py

Step 4 - Uninstall App

Make sure to remove the package from your requirements.txt as well as uninstalling it with PIP.


pip uninstall package-name

Final Notes

That's all there is to it! If you referenced the app in any of your models, you will most likely have migrations that reference the app you've just uninstalled. You will most likely need to modify them manually if they're causing you any issues.