1

I am using Django and I have an app inside called "stuff". I decided I didn't need it anymore so I removed all usage of it from all my files, I removed it from settings.py under installed apps, and then I just deleted its entire folder.

Is that okay to do? So far everything seems to still be running fine and it no longer shows up in my admin panel which is what I want. I was reading some other posts on how to remove a Django App and they were doing a lot of extra things like this:

https://stackoverflow.com/questions/3329773/django-how-to-completely-uninstall-a-django-app#:~:text=To%20remove%20the%20app%20from,your%20PYTHONPATH%20where%20it%20resides.

Should I be worried something bad will happen down the road? I can makemigrations and changes and do everything perfectly fine currently.

jh3215
  • 169
  • 6
  • The worst that can happen is one or the other exception to be raised and you might have to remove some references you missed in the first place. – Klaus D. Aug 15 '21 at 11:18
  • @KlausD. thanks, I was worried because that other post they were doing things like dropping tables and doing weird migrations from the start. – jh3215 Aug 15 '21 at 11:30
  • That is usually a problem if you application was not well designed. Especially if the models have references in both directions. In general try to write apps with models that have outbound relations, like a foreign key in the model instead of on in an other model that references yours. – Klaus D. Aug 15 '21 at 11:38
  • @KlausD. Oh I see, thank you. – jh3215 Aug 15 '21 at 11:40

1 Answers1

0

In case the "stuff" app had some models, It is a good idea to remove the tables associated to them from the database. Although they should no interfer in the correct execution of your site.

The easiest way in my opinion is to do python manage.py migrate stuff zero, before doing all the operations you describe.

At this point, if you pushed your code to a production environment, it is probably better not to mesh with the database directly and leave it as it is.

In case you have not put your website in production, this is you don't have any data in your production database, then you don't have to worry about it since the app no longer exists.

I've never done that on production so I cannot tell you that in my experience all the other steps are not needed. But I don't fell your approach is discorageous.

kiril
  • 4,914
  • 1
  • 30
  • 40