-
Notifications
You must be signed in to change notification settings - Fork 81
Code layout
We try to use standard Django conventions for code layout wherever
possible. On a small scale, that means that models go in models.py
,
serializers go in serializers.py
and so on. On a slightly larger
scale, it means that we try to structure the platform code as a set of
small interacting Django apps, each ideally not containing more than
about five main models.
The Cadasta platform provides both a "normal" HTML template based front-end and a RESTful API. As much code as possible is shared between these two interfaces, and all of our apps implement both HTML and REST views in parallel. We lay things out like this:
HTML API
.
├── forms.py X
├── migrations/ X X
├── mixins.py X X
├── models.py X X
├── serializers.py X
├── templates/ X X
│ ├── organization/ X
│ │ ├── organization_add.html X
│ │ ├── ... X
│ │ └── user_list.html X
│ └── org_invite.txt X X
├── templatetags/ X
│ └── wizard_state.py X
├── tests/ X X
│ ├── factories.py X X
│ ├── test_api.py X
│ ├── ... X X
│ └── test_validators.py X
├── urls/ X X
│ ├── api/ X
│ │ ├── organizations.py X
│ │ ├── projects.py X
│ │ └── users.py X
│ └── default/ X
│ ├── organizations.py X
│ ├── projects.py X
│ └── users.py X
├── validators.py X
└── views/ X X
├── api.py X
└── default.py X
Here, the urls
directory has api
and defaults
subdirectories
holding URLconf definitions for API and HTML-based endpoints, and the
views
directory contains API and HTML views in seperate files.
Tests all go in the tests
directory and share factories and other
test utilities. All model code is shared between the HTML-base and
RESTful endpoints.
Visit our User Documentation to learn more about using the Cadasta Platform.
If you'd like to contribute to the Cadasta Platform, start with our Contributing Guidelines.
Cadasta Wiki Home | Developer Setup Guide
Cadasta.org | About Cadasta | YouTube | Twitter | Facebook
- Installing & Running
- Contributing
- Planning & Sprints
- Platform Development
- Testing
- Utilities
- Outreachy
- Platform Site Map
- User Flows and Wireframes
- Other
- Quick Start Guide
- Glossary
- Questionnaire Guide