A simple lab management system.
Project description
SW Labs Management System
A comprehensive laboratory management system for software development labs, built with Flask and featuring file-based storage.
Features
- Lab Management: Create and manage multiple laboratories
- Station Management: Track individual workstations within labs
- Device Monitoring: Monitor PCs and servers with real-time ping status
- User Management: Admin and regular user roles with authentication
- File-Based Storage: Data stored in JSON files for easy backup and portability
- Real-time Status: Live device status monitoring
- Responsive UI: Modern Bootstrap-based interface
Quick Start
Prerequisites
- Python 3.7 or higher
- pip (Python package installer)
Installation
-
Clone or download the project
git clone <repository-url> cd SW-Lab-Manager
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python run.py -
Access the application
- Open your browser and go to:
http://localhost:5000 - Default admin credentials:
admin/admin123
- Open your browser and go to:
File-Based Storage
The system now uses JSON files for data storage instead of SQLite database:
data/users.json: User accounts and authentication datadata/labs.json: Laboratory informationdata/stations.json: Workstation data within labsdata/devices.json: Device information and status
Benefits of File-Based Storage
- Easy Backup: Simply copy the
data/folder to backup all data - Portable: Move data between systems by copying JSON files
- Human Readable: JSON files can be easily viewed and edited
- Version Control Friendly: JSON files work well with Git
- No Database Setup: No need to install or configure databases
Data Migration
If you have existing data in the SQLite database, you can migrate it to JSON files:
python migrate_to_files.py
This will create the data/ directory with JSON files containing your existing data.
System Architecture
Core Components
- Flask Web Framework: Backend API and web interface
- Flask-Login: User authentication and session management
- Bootstrap 5: Modern responsive UI
- ping3: Network device monitoring
- JSON Storage: File-based data persistence
Data Structure
data/
├── users.json # User accounts
├── labs.json # Laboratories
├── stations.json # Workstations
└── devices.json # Devices (PCs/Servers)
Usage
Admin Panel
Access the admin panel to manage:
- Labs: Create and configure laboratories
- Stations: Add workstations to labs
- Devices: Configure PCs and servers with IP addresses
- Users: Create and manage user accounts
Regular Users
Regular users can:
- View lab and station information
- Occupy and release stations
- Monitor device status
- View their activity history
Device Monitoring
The system automatically pings devices every 30 seconds to check their online status. Device status is displayed in real-time on the web interface.
Troubleshooting
Login Issues
If you experience login problems:
- Clear browser cache and cookies
- Check that the data/users.json file exists
- Verify admin credentials:
admin/admin123 - Restart the application
Device Monitoring Issues
If devices show as offline:
- Check IP addresses are correct in device configuration
- Verify network connectivity between the server and devices
- Check firewall settings that might block ping requests
- Ensure devices are powered on and connected to the network
File Storage Issues
If data files are corrupted:
- Backup the data/ directory before making changes
- Check JSON syntax in the data files
- Restore from backup if needed
- Run the migration script to recreate files
Development
Adding New Features
- Backend: Add routes in
app.py - Frontend: Create templates in
templates/ - Styling: Update
static/css/style.css - JavaScript: Modify
static/js/app.js
Data Model Changes
When modifying data structures:
- Update the JSON file schemas
- Modify the file-based storage functions in
app.py - Update the migration script if needed
- Test with sample data
Security Considerations
- Password Hashing: All passwords are hashed using Werkzeug's security functions
- Session Management: Flask-Login handles secure session management
- Input Validation: All user inputs are validated and sanitized
- File Permissions: Ensure data files have appropriate read/write permissions
Backup and Recovery
Regular Backups
# Backup all data
cp -r data/ backup/data_$(date +%Y%m%d_%H%M%S)/
# Restore from backup
cp -r backup/data_YYYYMMDD_HHMMSS/* data/
Data Export
You can export data to CSV format for external analysis:
python export_to_csv.py
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions:
- Check the troubleshooting section above
- Review the data files for corruption
- Check the application logs for error messages
- Create an issue in the project repository
Changelog
Version 2.0
- NEW: File-based storage system (JSON)
- FIXED: Login loading issue
- IMPROVED: Better error handling
- ADDED: Data migration script
- ENHANCED: Backup and recovery procedures
Version 1.0
- Initial release with SQLite database
- Basic lab and station management
- Device monitoring functionality
- User authentication system