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.