The Server is based on Django framework, a high-level Python Web framework. The reasons that has led us base our development on this framework are:
A more detailed discussion of the options can be found here.
Each piece of functionality is split into different applications. An app should be focused and follow the Unix philosophy of “do one thing and do it well”. In other words, an application encapsulates some particular feature. If this sounds new to you, maybe you're interested in this talk.
Following the Python modules that you can expect to find inside each application:
admin.pyAdmin interface support provided by django.contrib.admin.
api.pyREST API views based on Django REST Framework.
models.pyModels of the application (data layer)
permissions.pyPermission definitions (see Permissions Application).
settings.pySettings of the application (see Django settings).
urls.py: URLs configuration (see URL dispatcher).
fields.pyModel and Form Fields.
ifaces.pySliver network interface definitions.
notifications.py: pluggable notification system based on server-apps-notifications notification app.
tasks.py: Celery tasks (Celery is an asynchronous task queue/job queue based on distributed message passing).
utils.pyFunctions that do one repetitive and specific thing.
helpers.pyFunctions that are part of other functions, in contrast with utils, helpers functions are highly coupled with their parent and do not have context other than that.
tests.pyTests (see Testing in Django).
Apart from the ovbious benefit for others because of being able to reuse our software, writing code with reusability in mind also helps to keep the code structure clean and modular. Keep this in mind:
These are ideal states, be pragmatic above all :)
Well known related design principles:
Some online resources that can be worth reading
We will follow these guidelines:
Be careful choosing class, function and variable names: be descriptive and avoid abbreviations if they aren't clear (characters are almost free :)
If your code needs to be commented maybe is because it is too complex, give it a second thought!
Readings that you might find interesting: