Should I split a big Django project into many apps?
Asked Answered
A

1

8

Short version:
I have a Django project under development & testing (not yet into production) which is slowly getting “not-so-small”, and lately I've been wondering about splitting things up to keep it manageable.

Project layout:
The project comprises various reusable applications not developed by me, such as avatar, django_evolution, compressor, and a bigger -monolithic, I'd say- app developed by me which contains the main functionality of the site. The views file is reaching 1k lines and there are 12 models, but the functionalities are almost all in place (i.e. I'm not expecting them to grow 10x).

The doubt:
A distinction of the models and the views into three “groups” could be made leading to a separation into three apps, but:

  • there would be absolutely no reusability, as the apps are tied very tightly with each other
  • there is the problem of some “common areas” such as home page, although I've read that these could just be placed outside any project.

Finally, my question:
Can I get any advantage by splitting my app?
If it's only for readability and maintainability of the “big” files, I could just split those files and put them in a folder (as many related questions' answers suggest).

Avernus answered 3/3, 2010 at 18:48 Comment(0)
E
5

You don't have to split up your application into several apps if it doesn't make sense. But you can group your view functions into different view files. This would be a first step. There is no need to put all of them in one place.

Electrodeposit answered 3/3, 2010 at 18:55 Comment(1)
I took some time and split them. Works out great, views are incredibly more manageable!Avernus

© 2022 - 2024 — McMap. All rights reserved.