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:
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).
Django comes with six built-in apps that we can examine.
Any Django project consists of multiple applications.
No. It's better and in many cases it's probably the best. Django is a fantastic framework with thousands of plugins aka apps and has a huge developer community. Whenever you find a problem, you'll get a solution from SO, blogs and other resources.
If you want. Or split it up into two view files - views are just Python functions, they can live anywhere. Or have a separate app for all the admin functions across all your other apps. It's up to you.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With