Repository navigation
Backend Requirements Structure
Prince-Bert Beya edited this page May 18, 2026
·
5 revisions
The backend uses a structured requirements setup to separate shared runtime dependencies from development/test-only and production-only packages.
backend/
└── requirements/
├── base.txt # Shared runtime dependencies
├── development.txt # Development and test dependencies
└── production.txt # Production-only dependencies
This improves maintainability, onboarding, and environment consistency.
Shared dependencies required in all environments, such as Django, Django REST Framework, database drivers, API documentation tools, caching support, and media/image handling.
Extends base.txt via:
-r base.txtAdds development and test tools such as:
- pytest
- pytest-django
- pytest-cov
- factory-boy
- Faker
- django-debug-toolbar
- ruff
Extends base.txt via:
-r base.txtAdds production-only packages such as:
- gunicorn
Commands below assume you are in the repository root.
pip install -r backend/requirements/development.txtpip install -r backend/requirements/production.txt- Install the package locally:
pip install <package>- Add it to the correct requirements file:
-
base.txt— needed in every environment. -
development.txt— needed only for testing, debugging, linting, or local development. -
production.txt— needed only at runtime in production.
- Pin the version explicitly.
- Run the relevant tests/lint checks.
- Commit the updated requirements file.
- Lines starting with
#are comments and are ignored bypip. - Prefer short comments above dependency groups when that improves readability.
- Keep environment-specific packages out of
base.txtunless every environment needs them.