Skip to content

williamalexakis/stcats-ops

Repository files navigation

StCats Ops

Overview

A full-stack internal web platform that supports timetable scheduling, resource management, testing, and various administration purposes – built for the St. Catherine's British School Computer Science Department.

Features

  • Microsoft SSO – Signups and logins can be performed via Microsoft Azure AD.
  • RBAC Security Model – User roles define permissions; admins have access to a dedicated dashboard and a custom suite of management actions.
  • Scheduling System – Manage lessons through a calendar-style scheduler; export filtered schedules as .csv files.
  • Code Editor – Run Python code in-browser; import .py files and export current code.
  • Invite Codes – All signups require codes generated by admins using a custom closed authorization system.
  • Audit Trail – Every POST request and admin action is logged and reviewable.

Screenshots

Homepage

Homepage

Schedule

Schedule

Admin Dashboard

Admin Dashboard

Audit Logs

Audit Logs

Tech Stack

Frontend

  • HTML, CSS, JavaScript
  • Monaco Editor
  • Font Awesome

Backend

  • Python, Django
  • PostgreSQL
  • Gunicorn
  • WhiteNoise
  • Pyodide

Infrastructure

Localhost Setup

Prerequisites

  • Python 3.10+
  • A database connection string (SQLite or PostgreSQL
  • An Azure AD application ID, client secret, and tenant ID (optional; required for testing Microsoft SSO)

Site Creation

  1. Run the following commands:

    git clone https://github.com/williamalexakis/stcats-ops.git
    cd stcats-ops
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  2. Create a .env file with the following configuration:

    DEBUG=True                         # Set to False in production
    SECRET_KEY=change-me               # Provide a unique secret in production
    DATABASE_URL=sqlite:///db.sqlite3  # Or e.g. postgres://user:pass@localhost:5432/stcats for PostgreSQL
    ALLOWED_HOSTS=127.0.0.1,localhost  # Set to website name in production
    CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8000,http://localhost:8000  # Set to valid URI in production
    SESSION_COOKIE_SAMESITE=Lax               # Required for Microsoft redirects
    CSRF_COOKIE_SAMESITE=Lax                  # Required for Microsoft redirects
    SOCIAL_AUTH_AZUREAD_OAUTH2_KEY=...        # Azure AD application (client) ID
    SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET=...     # Azure AD client secret
    SOCIAL_AUTH_AZUREAD_OAUTH2_TENANT_ID=...  # Azure AD tenant ID (GUID)
    SOCIAL_AUTH_REDIRECT_IS_HTTPS=False       # Set True behind HTTPS proxy
  3. Run the following commands:

    python manage.py migrate
    python manage.py seed_groups
    python manage.py createsuperuser
    python manage.py runserver
  4. Visit http://localhost:8000/admin/ and log in with your superuser credentials.

Important

All non-superuser account creations require an invite code generated by an admin.

Management Commands

Command Purpose
python manage.py seed_groups Ensure the teacher and admin groups exist; safe to run multiple times.
python manage.py cleanup_invites Remove expired or fully consumed invite codes.
python manage.py cleanup_schedule Remove finished schedule entries.
python manage.py test Run the Django unit test suite.