How to delete an app from a django project

You need to remove or check the following:

  • Remove the app from INSTALLED_APPS.
  • Remove any database tables for the models in that app (see app_name_model_name in your database).
  • Check for any imports in other apps (it could be that they're importing code from that app).
  • Check templates if they are using any template tags of that app (which would produce errors if that app is no longer there).
  • Check your settings file to see if you're not using any code from that app (such as a context processor in your_app/context_processors.py, if it has such as file).
  • Check if any static content of the app is used in other apps.
  • Remove the app directory entirely.

When you've been following proper coding principles (i.e., each Django app is a self-contained part of the web application) then most situations above won't occur. But when other apps do use some parts of that app, you need to check that first as it may require refactoring before deleting the app.

Tags:

Python

Django