Django Architecture
Our Django projects have the following structure:
- Features are grouped into domains (micro apps).
- Every domain is self-contained and has its own package.
- Each domain should be as decoupled from other domains as possible.
- Domain functionality is grouped by its type and is placed to appropriate modules (view functions/classes go to views module, serializer functions/classes go to serializers module, etc.).
- If a module file contains too much logic it should be split into separate module files with a dedicated directory.
- Each domain has a separate
test/
directory (see Django testing). - There is a wrapper domain which ties other domains together and contains project specific configuration.
- The wrapper domain usually has the same name as the project.
- The wrapper domain contains settings module which includes
development.py
andproduction.py
files which in turn contains development and production specific configuration settings.