A secure and efficient system for student verification and gate access management using QR codes. This system is designed for university environments, providing a modern and secure way to manage student access to campus facilities.
- 🔒 Secure QR code generation with encryption and expiration
- 📱 Mobile-friendly interface
- ⚡ Real-time verification
- 📊 Admin dashboard for user management
- 🔐 Role-based access control
- 📝 Activity logging and monitoring
- 🎨 Modern, responsive UI
- 🔄 Automatic QR code refresh
- Python 3.8 or higher
- Django 4.2 or higher
- PostgreSQL database
- Virtual environment (recommended)
- Clone the repository:
git clone [repository-url]
cd qr-verification-system
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install required packages:
pip install -r requirements.txt
- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration
- Run database migrations:
python manage.py makemigrations
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
-
Update settings in
settings.py
:- Database configuration
- Email settings
- Security settings
- QR code settings
-
Configure your email settings for QR code delivery:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'your-smtp-host'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@example.com'
EMAIL_HOST_PASSWORD = 'your-email-password'
- Start the development server:
python manage.py runserver
-
Access the admin interface:
- URL: http://localhost:8000/admin
- Login with your superuser credentials
-
Generate QR codes for students:
- Navigate to the admin interface
- Select a student
- Generate and send QR code
-
Use the scanner interface:
- URL: http://localhost:8000/scanner
- Scan student QR codes for verification
- JWT-based QR code encryption
- Rate limiting for API endpoints
- CSRF protection
- XSS protection
- SQL injection prevention
- Secure session management
- Input validation and sanitization
-
Server Requirements:
- CPU: Intel Core i5 or equivalent
- RAM: 8GB minimum
- Storage: 256GB SSD
- Network: Gigabit Ethernet
-
Software Requirements:
- Ubuntu Server LTS
- Nginx
- PostgreSQL
- Python 3.8+
- SSL certificate
-
Deployment Steps:
# Install system dependencies sudo apt update sudo apt install python3-pip python3-venv nginx postgresql # Set up PostgreSQL sudo -u postgres psql CREATE DATABASE qr_system; CREATE USER qr_user WITH PASSWORD 'your_password'; ALTER ROLE qr_user SET client_encoding TO 'utf8'; ALTER ROLE qr_user SET default_transaction_isolation TO 'read committed'; ALTER ROLE qr_user SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE qr_system TO qr_user; \q # Configure Nginx sudo nano /etc/nginx/sites-available/qr_system
Add the following configuration:
server { listen 80; server_name your_domain.com; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /path/to/your/project; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } }
# Enable the site sudo ln -s /etc/nginx/sites-available/qr_system /etc/nginx/sites-enabled sudo nginx -t sudo systemctl restart nginx # Set up Gunicorn sudo nano /etc/systemd/system/gunicorn.service
Add the following configuration:
[Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=your_user Group=www-data WorkingDirectory=/path/to/your/project ExecStart=/path/to/venv/bin/gunicorn \ --access-logfile - \ --workers 3 \ --bind unix:/run/gunicorn.sock \ qr_system.wsgi:application [Install] WantedBy=multi-user.target
# Start Gunicorn sudo systemctl start gunicorn sudo systemctl enable gunicorn
-
Regular Tasks:
- Database backups
- Log rotation
- Security updates
- Performance monitoring
-
Backup Commands:
# Database backup pg_dump -U qr_user qr_system > backup.sql # Media files backup tar -czf media_backup.tar.gz media/
Common issues and solutions:
-
Database Connection:
- Check PostgreSQL service status
- Verify database credentials
- Ensure database exists
-
QR Code Generation:
- Check email settings
- Verify file permissions
- Check storage space
-
Scanner Issues:
- Verify camera permissions
- Check browser compatibility
- Clear browser cache
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please contact:
- Email: ongjamesdaryl@gmail.com
- Django Framework
- QR Code Library
- All contributors and maintainers