Skip to content

Folder layout ​

api/
├── manage.py               # the Django command: runserver, migrate…
├── trinity_api/            # the Django project
│   ├── settings.py         # settings, read from the environment
│   ├── urls.py             # addresses: /admin/, /health, /api/
│   └── wsgi.py             # Gunicorn entry point
├── products/               # the "products" application
│   ├── models.py           # the Product table
│   ├── serializers.py      # Product ↔ JSON
│   ├── views.py            # ProductViewSet
│   ├── admin.py            # Product in the Django admin
│   ├── tests.py            # the 7 tests
│   └── migrations/         # the table's history
├── requirements.txt        # Python libraries
├── pytest.ini              # pytest settings
├── entrypoint.sh           # prod image startup: migrate + collectstatic
├── Dockerfile.dev          # development image
├── Dockerfile.prod         # production image
├── .gitlab-ci.yml          # api:lint, api:test, api:build jobs
└── .env.example            # expected variables, with example values

The layout rule ​

FileContainsDoes not contain
models.pythe table's fields and constraintsHTTP logic
serializers.pywhich fields to expose, which are read-onlydirect access to the request
views.pywhich operations are possibleJSON format
urls.pyaddressesbusiness logic