A Persian (RTL) online English-teaching platform built with Django 5 + SQL Server. Students take an AI-graded placement test, enrol in level-matched online classes, find conversation partners, and sit teacher-built exams; teachers run classes, attendance, grading, and get paid.
- Auth — phone-based, OTP or password (rate-limited + brute-force lockout).
- Placement test — writing graded by an LLM (with retry + feedback), reading & listening auto-graded → CEFR level (A1–C2).
- Classes — capacity-limited, online (Jitsi), Jalali calendar, tuition payments.
- Partner matching — same level + overlapping free time → shared meeting link.
- Exams — teacher-built midterm/final (MC, reading, writing, listening); teachers view answer sheets and grade writing; students review their own answers.
- Payments — Zarinpal gateway (mock in dev), teacher payout tracking.
- Certificates — printable end-of-course transcript.
- Notifications — SMS reminders for sessions/exams and partner matches (Kavenegar).
- Admin — custom-skinned Django admin.
- Python 3.11+
- SQL Server (prod) with the ODBC Driver 18 for SQL Server
- Redis (prod — the OTP throttle and login lockout live in the cache)
python -m venv .venv
.venv/Scripts/activate # Windows; source .venv/bin/activate on *nix
pip install -r requirements.txt
cp .env.example .env # then edit values
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver| Var | Purpose |
|---|---|
SECRET_KEY |
Django secret (required when DEBUG=False) |
DEBUG |
True for local dev |
ALLOWED_HOSTS |
comma-separated hostnames |
CSRF_TRUSTED_ORIGINS |
comma-separated https origins |
DB_NAME / DB_HOST / DB_DRIVER |
SQL Server connection |
REDIS_URL |
e.g. redis://localhost:6379/0 (falls back to in-memory if unset) |
OPENAI_API_KEY |
writing grader |
SMS_API_KEY |
Kavenegar SMS |
ZARINPAL_MERCHANT_ID |
payment gateway (mock gateway used if unset) |
Runs on SQLite in-memory — no SQL Server needed:
python -m pytestSend session/exam reminders (run daily from cron):
python manage.py send_session_reminders # add --dry-run to previewDockerfile + docker-compose.yml are provided (web + redis; SQL Server is external).
On deploy: python manage.py migrate && python manage.py collectstatic --noinput,
then serve with gunicorn behind an HTTPS-terminating proxy. Security headers
(HSTS, secure cookies, SSL redirect) switch on automatically when DEBUG=False.