A Flask-based web application for managing student attendance using QR or RFID scanning. The system records attendance in real time and classifies students as Present (P), Late (L), or Absent (A).
This was my first software project while learning Python and web development. It works, but it also reflects beginner design choices. This README explains what the project does and how I would improve it if building it today.
- Real-time attendance tracking
- Web interface to add staff and students
- Subject-wise attendance records
- SQLite-based local storage
- Session timeout and late marking logic
main.py: Flask web app and routesScanner.py: Attendance scanner processpractice.py: Student and staff management logicutilities.py: Shared DB utility functionsreset.py: Database reset utilitytemplates/: HTML templates for UIAttendance.db: SQLite databaserequest_logs.txt: Runtime log used by scanner flow
- Python 3.x
- Flask 3.x
- SQLite3
- Activate virtual environment:
source virt/bin/activate- Run the web application:
python main.py- Run the scanner in another terminal:
python Scanner.py- Add staff via
/addstaffs - Add students via
/addstudents - Start
Scanner.py - Scan staff ID to start a class session
- Scan student IDs to mark attendance
roll_no(PK)nameemailcitycountryphonedob
Roll_Number(PK)NameSubject
For each subject, a table is created dynamically with student list and session columns.
For each subject, [subject]_col stores session column names.
GET /: Home pageGET/POST /addstudents: Register studentGET/POST /addstaffs: Register staffGET /students: View studentsGET /subject/<name>: View attendance by subjectGET /server/request: Scanner helper endpoint
- Old approach used string interpolation in SQL
- Better approach is parameterized queries to prevent SQL injection
- Old code used many
except:blocks - Better approach is catching specific exceptions and logging useful error messages
- Old code had machine-specific absolute paths and IPs
- Better approach is environment-based configuration
- Old flow used a text file for process communication
- Better approach is Redis, queue, or websocket-based messaging
- Old code accepted raw form input with minimal checks
- Better approach is stricter validation and normalization for all fields
- Logic spread across scripts with limited separation of concerns
- Better approach is layered modules (
routes,services,models,config)
- Use SQLAlchemy ORM + migrations
- Add authentication and role-based access
- Add unit and integration tests
- Replace file IPC with Redis or queue system
- Add structured logging
- Use
.envconfiguration - Containerize with Docker
Current project is educational and local-first. Before production usage, add:
- Authentication and authorization
- HTTPS
- Input validation hardening
- Rate limiting
- Secret management
- Backup and recovery strategy
- Use parameterized SQL everywhere
- Do not hide errors with bare exceptions
- Validate every user input
- Keep concerns separated in code structure
- Avoid hardcoded environment-specific values
- Add tests early
- Keep docs accurate and simple
- Built with Flask, SQLite, Python 3.11
- Refactored for improved readability and safety
- Maintained as a learning-focused project