A comprehensive web-based attendance management system built with Python Flask, featuring real-time QR code scanning, dynamic QR rotation, cloud synchronization, and real-time updates via WebSocket.
- Python 3.8+
- pip (Python package manager)
-
Navigate to the project directory:
cd python_attendance_system -
Create and activate virtual environment:
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python run.py
-
Open in browser:
- Main page: http://localhost:5000
- Student login: http://localhost:5000/auth/student/login
- Professor login: http://localhost:5000/auth/professor/login
| Role | Password | |
|---|---|---|
| Professor | professor@acem.ac.in | password123 |
| Student | student@acem.ac.in | password123 |
- β Create and manage classes
- β Start/stop attendance sessions
- β Generate dynamic QR codes (rotate every 30 seconds)
- β View real-time attendance
- β Enroll students in classes
- β Update attendance status
- β View analytics and reports
- β Complete sessions (auto-mark absent)
- β Cancel sessions
- β View enrolled classes
- β Scan QR codes to mark attendance
- β View attendance history
- β Receive notifications
- β Track attendance rate per class
- β Update profile
- π HMAC-SHA256 signed QR codes
- π 30-second QR expiration
- π Nonce to prevent replay attacks
- π Device fingerprinting
- π IP address logging
- π Email domain restriction (@acem.ac.in)
python_attendance_system/
βββ app/
β βββ __init__.py # Flask app factory
β βββ models.py # SQLAlchemy database models
β βββ routes/
β β βββ auth.py # Authentication routes
β β βββ main.py # Home and common pages
β β βββ student.py # Student dashboard and features
β β βββ professor.py # Professor dashboard and features
β β βββ api.py # API endpoints
β βββ templates/ # Jinja2 HTML templates
β β βββ base.html
β β βββ auth/
β β βββ main/
β β βββ student/
β β βββ professor/
β βββ utils/
β βββ qr_generator.py # QR code generation & validation
β βββ session_generator.py
β βββ seed_data.py # Initial database data
βββ config.py # Configuration settings
βββ run.py # Application entry point
βββ requirements.txt # Python dependencies
βββ FEATURES_DOCUMENTATION.md # Complete feature documentation
Edit config.py to modify:
# QR Code settings
QR_EXPIRY_SECONDS = 30 # QR codes expire in 30 seconds
QR_ROTATION_INTERVAL = 30
# Email domain restriction
ALLOWED_EMAIL_DOMAIN = '@acem.ac.in'
# Attendance settings
LATE_THRESHOLD_MINUTES = 5 # Students marked late after 5 minutes- Professor starts session β Dynamic QR code generated
- QR code displayed β Rotates every 30 seconds
- Student scans QR β Using phone camera or web scanner
- System validates β Checks signature, expiration, enrollment
- Attendance recorded β Present or Late (based on time)
- Professor ends session β Absent students auto-marked
{
"sessionId": "uuid-string",
"timestamp": 1736697600000,
"nonce": "random-16-byte-hex",
"signature": "hmac-sha256-hex",
"expiresAt": "2026-01-12T12:00:30Z"
}- Chrome (recommended)
- Firefox
- Safari
- Edge
Camera access required for QR scanning.
POST /auth/login- General loginPOST /auth/student/register- Student registrationPOST /auth/professor/register- Professor registrationGET /auth/logout- Logout
GET /student/dashboard- DashboardGET /student/classes- Class listGET /student/scan- QR scannerPOST /student/scan/process- Process scanGET /student/attendance- Attendance history
GET /professor/dashboard- DashboardGET /professor/classes- Class listPOST /professor/classes/create- Create classGET /professor/sessions- All sessionsPOST /professor/sessions/<id>/activate- Start sessionPOST /professor/sessions/<id>/complete- End session
GET /api/health- System health checkGET /api/sessions/<id>/qr- Get QR codeGET /api/sessions/<id>/attendance- Get attendance
For complete feature documentation, see FEATURES_DOCUMENTATION.md
SQLite database stored in instance/attendance.db
Flask-SocketIO for WebSocket connections
Jinja2 templates with Tailwind CSS styling
This project is for educational purposes.
Smart Attendance Management System - Making attendance tracking modern, secure, and efficient.