Containerized Django + DRF showcase project with employee and salary-statistics endpoints.
docker compose upApplication URL: http://localhost:8000
docker compose run web python3 manage.py testYou can use either token or basic authentication.
Token flow:
- Open
http://localhost:8000/admin/authtoken/tokenproxy/ - Login with:
username: clipboardpassword: clipboard
- Use the returned token as
Authorization: Token <TOKEN>
Basic auth:
clipboard:clipboard
Create employee:
curl http://localhost:8000/employees/ \
-H "Content-Type: application/json" \
-H "Authorization: Token YOUR_TOKEN" \
-d '{"name":"Marco","salary":"145000","currency":"USD","department":"Engineering","sub_department":"Machine Learning"}'Delete employee:
curl -X DELETE http://localhost:8000/employees/EMPLOYEE_UUID/ \
-H "Authorization: Token YOUR_TOKEN"Get overall salary stats:
curl http://localhost:8000/ss/ \
-H "Authorization: Token YOUR_TOKEN"Get salary stats filtered by contract:
curl "http://localhost:8000/ss/?on_contract=true" \
-H "Authorization: Token YOUR_TOKEN"Get salary stats filtered by currency:
curl "http://localhost:8000/ss/?currency=EUR" \
-H "Authorization: Token YOUR_TOKEN"Get salary stats by department:
curl http://localhost:8000/departments/ss/ \
-H "Authorization: Token YOUR_TOKEN"Get salary stats by department/sub-department:
curl http://localhost:8000/sub_departments/ss/ \
-H "Authorization: Token YOUR_TOKEN"- Django + Django REST Framework + SQLite
- Serializer-based validation for request and response payloads
- Department/sub-department modeled as dedicated entities
- Demo data initialization command runs during first container startup