delete-app.txt 1.0 KB

1234567891011121314151617181920212223242526272829
  1. ==================================
  2. How to delete a Django application
  3. ==================================
  4. Django provides the ability to group sets of features into Python packages
  5. called :doc:`applications</ref/applications/>`. When requirements change, apps
  6. may become obsolete or unnecessary. The following steps will help you delete an
  7. application safely.
  8. #. Remove all references to the app (imports, foreign keys etc.).
  9. #. Remove all models from the corresponding ``models.py`` file.
  10. #. Create relevant migrations by running :djadmin:`makemigrations`. This step
  11. generates a migration that deletes tables for the removed models, and any
  12. other required migration for updating relationships connected to those
  13. models.
  14. #. :ref:`Squash <migration-squashing>` out references to the app in other apps'
  15. migrations.
  16. #. Apply migrations locally, runs tests, and verify the correctness of your
  17. project.
  18. #. Deploy/release your updated Django project.
  19. #. Remove the app from :setting:`INSTALLED_APPS`.
  20. #. Finally, remove the app's directory.