I am currently building a distributed application using Python/Django. Any particular server will need to reference a core set of capabilities, plus specific capabilities for its situation. Some pieces will need the full model-view-template system, others will just need to share models. One part of the application will use an in-memory database while the rest of the application uses an Enterprise-class database.
I've chosen to structure this application as a set of 'apps' that can be turned on or off by using a 'smart' settings.py
and urls.py
scripts. The 'core' app will only have models that are common to the entire application (but no views or templates). The 'webcore' app will add views and templates that are common across all of the apps that provide a web UI. Other apps will have their own models, plus appropriate views and templates. Some apps will only implement background services, and so won't need views or templates.
By combining multiple apps in the settings.py
and urls.py
scripts, I can build and test small pieces of the application, without having to deal with the complexity of the entire application. I can also distribute parts of the application to multiple servers (for scaling or to take advantage of unique resources). If I were building this application using a single 'app' I'd lose a lot of flexibility.