File: delete-app.txt

package info (click to toggle)
python-django 3%3A5.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 61,236 kB
  • sloc: python: 361,585; javascript: 19,250; xml: 211; makefile: 182; sh: 28
file content (29 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
==================================
How to delete a Django application
==================================

Django provides the ability to group sets of features into Python packages
called :doc:`applications</ref/applications/>`. When requirements change, apps
may become obsolete or unnecessary. The following steps will help you delete an
application safely.

#. Remove all references to the app (imports, foreign keys etc.).

#. Remove all models from the corresponding ``models.py`` file.

#. Create relevant migrations by running :djadmin:`makemigrations`. This step
   generates a migration that deletes tables for the removed models, and any
   other required migration for updating relationships connected to those
   models.

#. :ref:`Squash <migration-squashing>` out references to the app in other apps'
   migrations.

#. Apply migrations locally, runs tests, and verify the correctness of your
   project.

#. Deploy/release your updated Django project.

#. Remove the app from :setting:`INSTALLED_APPS`.

#. Finally, remove the app's directory.