Remove an app from django project
https://stackoverflow.com/questions/3329773/how-to-completely-uninstall-a-django-app
Did it once, today, here are the commits:
And below are the steps I took:
Each heading can be a single commit. Do this step by step.
1 1. making the app invisible from the UI
Hiding the links to the app (base.html, etc), removing it from project's urls.py file.
When you navigate in the page - you should not get any errors.
2 2. Dealing with the DB table
Luckily my app did not have dependencies to other apps at this time. So it's quite simple.
- comment out
models.py
file content of the app - comment out
admin.py
file content of the app
Now you should be able to run the app just fine as well, visit the /admin page results in no errors.
Run makemigrations
A migration file will appear in that apps's directory.
Run migrate
Then changes should be applied. In our case - deletion of the tables in our db should be performed.
Commit those changes.
3 3. In PROD
Pull the most recent repo changes, run migrate
(since the newest deletion
migrations file should be there).
Confirm that the tables were deleted:
python manage.py shell --settings=settings.production
from django.db import connection tables = connection.introspection.table_names() print(sorted(tables))
Tables should no longer be there.
4 4. Delete the app folder
Delete and commit.