Removing app in django 1.11

Hi all, I’m new to these forums.
I’m working on a project using django 1.11, I was wondering that if we don’t an app anymore, so first we remove the models and then generate and run migrations, and then remove the app would the migrations table be cleaned and would permissions for that model also be removed?

  • Remove the application code and all of its dependencies in corresponding models/views/forms etc.
  • Remove its installation from INSTALLED_APPS in
  • Run make migrations and migrate.

That should do the trick. The migrations files are located within the application so removing those file and migrating the database again should solve your problem.

Hope this helps!
– Austin

To better answer your question: yes, the migrations and permissions should be automatically deleted. Any changes to the database are made using the migration files. If those don’t exist, and you re-run the migrating database commands, the database should recognize this and take the appropriate action. Django generates default CRUD permissions on a per-model basis.

Thanks, will this also remove the tables for those models?

Yep! If all instances of the model are removed, you shouldn’t receive any errors.

It’s going to be a little more than this. If you’re removing the app directory, that implies you’re also deleting the migration files. If you delete the migration files, then the migration table in django will be out of sync with the file system.

The best summary I’ve found for cleanly removing an app is this blog post.


1 Like