Warning
The default configuration is meant for development environment or internal use. When deployed in production, make sure:
- Replace
SECRET_KEY, disableDEBUG, configureALLOWED_HOSTSand CSRF settings inproject/settings.py. - Configure proper insulation / rate limiting for nginx gateway on sensitive interfaces, like
admin/,login/,docs/.
docker compose up
This spins up the app with a postgres service. Please refer to docker-compose.yml for common configurations.
Note
BASE_URL is http://localhost:8080/ (localhost is the default tenant domain)
The app also supports manual deployment. It falls back to sqlite (in repo root dir) when postgres config is not provided.
git clone, navigate to repository root directory.- Install dependencies by
uv sync. - Setup database by
uv run manage.py makemigrations BetaTrax && uv run manage.py makemigrations && uv run migrate - Start server by
uv run gunicorn project.wsgi:application
- Web framework: Django 6.x with gunicorn wsgi
- Database: PostgreSQL 18 (sqlite3 can be used for local unit tests)
- Docker image:
ghcr.io/astral-sh/uv:python3.13-bookworm-slim - Authentication: Django custom user model (
Employeewith roles:PRODUCT_OWNER,DEVELOPER) - Email-notification helper:
BetaTrax/email.py(notify_tester_statuscalled on status transitions) - API endpoints are defined in
BetaTrax/views.pyandproject/urls.py. - CSRF: currently disabled until frontend is connected.
Product Owner(rolePRODUCT_OWNER)Developer(roleDEVELOPER)Tester(report creator via/report/POST)
- NEW -> OPENED -> ASSIGNED -> FIXED -> RESOLVED
- Additional dead states:
REJECTED,DUPLICATED,COULDNT_REPRODUCE, andREOPENED.
- Endpoint:
POST /report/ - Required fields:
title,description,reproduce_steps,product,tester_id. - Optional:
tester_email. - Initial status:
NEW.
OPEN: onNEW-> setsseverity,priority, statusOPENED.REJECT: onNEW-> statusREJECTED.DUPLICATE: onNEW-> setsduplicate_of, statusDUPLICATED.REOPEN: onFIXED-> statusREOPENED.RESOLVE: onFIXED-> statusRESOLVED.
ASSIGN: onOPENED/REOPENED-> clearsOPENED/REOPENED, statusASSIGNED.FIX: onASSIGNED-> clearsassigned_to, statusFIXED.CANNOT_REPRODUCE: onASSIGNED-> clearsassigned_to, statusCOULDNT_REPRODUCE.
GET /report/with query params (return all filtered reports):status(anyReportStatusvalue or omitted)search(title contains)sort(-updated_at,-severity,-priority)page(1-based, 20 items/page)
GET /report/<id>/returns full report details.
GET /report/<id>/comments/returns comments for report (ordered by newest first).POST /report/<id>/comments/adds comment as current authenticated user.- Required field:
content
- Required field:
- (Updated in Sprint 2 with ordering and required field validation)
POST /login/withemail,password.POST /logout/.- All report and comment endpoints require logged-in users (403 otherwise), except report creation.
- Status transition validation is enforced in
ReportView.patchviaReportActionandReportStatus. - People management via
Employeemodel with role guard in report access (owners see product reports; developers only assigned reports).
GET /employee/<id>/returns employee details (id, email, role, product) for authenticated users.PATCH /employee/<id>/allows employees to assign themselves to a product (requires self-access, product must not have an owner).- Required field in JSON body:
product(product ID)
- Required field in JSON body:
GET /product/list products with query param:page(1-based, 20 items/page, requires login)- Returns fields:
id,name,owner,created_at,updated_at
POST /product/create product (requires PRODUCT_OWNER role)- Required field:
name
- Required field:
- Run all tests:
docker compose exec betatrax uv run manage.py test tests
- For specific module:
docker compose exec betatrax uv run manage.py test tests.test_crud: life-cycle transitions and permission checks.docker compose exec betatrax uv run manage.py test tests.test_view: filters, status querying, pagination, report details, developer effectiveness metric.docker compose exec betatrax uv run manage.py test tests.test_comment: comment creation/listing behavior.docker compose exec betatrax uv run manage.py test tests.test_product: product creation/listing/assignment behavior.
(These confirm life-cycle transitions, role-based access, report filtering, and comment behavior.)
-
Install coverage tool:
docker exec betatrax uv pip install coverage
-
Run all tests with branch coverage:
docker exec betatrax uv run coverage run --branch manage.py test tests
-
Run specific module with coverage:
docker exec betatrax uv run coverage run --branch manage.py test tests.test_crud: life-cycle transitions and permission checks.docker exec betatrax uv run coverage run --branch manage.py test tests.test_view: filters, status querying, pagination, report details, developer effectiveness metric.docker exec betatrax uv run coverage run --branch manage.py test tests.test_comment: comment creation/listing behavior.docker exec betatrax uv run coverage run --branch manage.py test tests.test_product: product creation/listing/assignment behavior.
-
Generate text coverage report:
docker exec betatrax uv run coverage report -m: Text summary with missing lines
-
Generate HTML coverage report:
docker exec betatrax uv run coverage htmldocker cp betatrax:/app/htmlcov ./htmlcov
-
Open the coverage report in the default web browser:
start htmlcov/index.html
Access swagger-ui by http://localhost:8080/docs/