Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I split a big Django project into many apps?

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).

like image 951
Agos Avatar asked Mar 03 '10 18:03

Agos


People also ask

How many apps should a Django project have?

Django comes with six built-in apps that we can examine.

Can a Django project have multiple apps?

Any Django project consists of multiple applications.

Is Django good for big projects?

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.

Can you create more than two Django apps in Django framework?

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.


1 Answers

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.

like image 83
Felix Kling Avatar answered Oct 12 '22 15:10

Felix Kling