Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete an app from a django project

Tags:

python

django

Initially I made 2 apps (app_a and app_b) in a single project in Django. Now I want to delete one (say app_a). How should I do so? Is removing the app name from INSTALLED_APPS in the settings file sufficient?

like image 321
nimeshkiranverma Avatar asked Jul 08 '12 11:07

nimeshkiranverma


Video Answer


1 Answers

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.

like image 112
Simeon Visser Avatar answered Sep 23 '22 04:09

Simeon Visser