Imported from manarangrhomar-creator/OJT-MONITORING (
AGENTS.md). Install upstream withnpx skills add manarangrhomar-creator/OJT-MONITORING. Copyright stays with the author.
AGENTS.md — OJT Monitoring System
Commands
| Action | Command |
|---|---|
| Dev server | python manage.py runserver |
| Test all | python manage.py test |
| Test one app | python manage.py test apps.core (or authentication, admin_panel, coordinator, student) |
| Shell | python manage.py shell |
| Make + apply migrations | python manage.py makemigrations; python manage.py migrate |
| Static files | python manage.py collectstatic --noinput |
| Stub user creation | python manage.py createsuperuser |
| Docker full stack | docker-compose up (starts db, redis, web, celery worker) |
| Celery (Windows) | celery -A ojt_monitoring worker -l info --pool=solo |
No linter, formatter, typechecker, pre-commit, or CI config exists. Tests are minimal placeholders.
Architecture
- Django 4.2 + DRF 3.14, custom
Usermodel (apps/core/models.py:9, UUID PK,roleinadmin|coordinator|student) - DRF Token Auth (
rest_framework.authtoken), CSRF middleware disabled (settings.py:71) - ASGI via Daphne/Channels — WebSocket consumers at
apps/core/consumers.py - Celery with Redis broker;
CELERY_TASK_ALWAYS_EAGER=Trueby default so tasks run synchronously unless a Redis is running - SQLite for dev (
settings.py:120-126), PostgreSQL in Docker/production;.envPostgreSQL vars are NOT used by settings.py (sqlite3 is hardcoded) - drf-spectacular at
/api/docs/(Swagger),/api/schema/(OpenAPI) - All endpoints use DRF ViewSets + DefaultRouter; check each app's
urls.pyfor generated routes
App structure
| App | Models | Routes prefix |
|---|---|---|
core |
User, Course, Notification |
/api/ (notifications WS) |
authentication |
PasswordResetOTP, LoginAttempt |
/api/auth/ |
admin_panel |
SystemLog, SystemSettings |
/api/admin/ |
coordinator |
OJTProgram, OJTApplication, Attendance, Site, SiteAssignment |
/api/coordinator/ |
student |
StudentProfile, StudentNarrativeReport, FacialRecognition |
/api/student/ |
Key quirks
- Superusers auto-get
role='admin'viapost_savesignal inapps/core/models.py:52-60 - Login accepts
identifierfield (username or email) - Student registration creates
StudentProfilebut does NOT log user in — requires coordinator approval - Forgot password uses 3-step OTP flow: send OTP → verify OTP → reset password
- Docker/web entrypoint runs
migratethenrunserver; nomakemigrationsstep - The
.envfile contains real Gmail credentials — do not commit or expose ALLOWED_HOSTSincludes*— permissive in dev
Frontend
- Django templates in
templates/, Tailwind CSS via CDN, vanilla JS static/js/auth.jshandles token storage, login/register/logout, role-based redirect- WebSocket at
ws://host/ws/notifications/?token=...andws://host/ws/dashboard/?token=...
Live Dashboard
The coordinator dashboard (templates/coordinator_dashboard.html) has two WebSocket connections:
- Notifications —
connectNotifSocket()for real-time notifications - Dashboard —
connectDashboardSocket()for live section updates (overview, reports, attendance, applications, sites, students)
broadcast_dashboard_update(section) in apps/core/utils.py broadcasts via DashboardConsumer. It silently catches exceptions, so it won't break existing flows.
Coordinator-side broadcasts are in apps/coordinator/views.py: OJTApplicationViewSet.approve/reject, AttendanceViewSet.clock_in/clock_out, CoordinatorDashboardViewSet.approve_student/reject_student.
Student-side broadcasts are in apps/student/views.py: StudentDashboardViewSet.apply/clock_in/clock_out, StudentNarrativeViewSet.perform_create/submit_with_photos.