Admin GUI Manual¶
This manual explains how to use the Django Admin interface for managing MyCyclingCity.
Accessing the Admin Interface¶
- Navigate to:
http://your-domain/admin/ - Log in with your superuser credentials
- You'll see the admin dashboard with all available models
Main Sections¶
The admin interface is organized into the following sections:
MCC Core API & Models¶
Core functionality for cyclists, groups, and mileage tracking.
Group Types¶
- Purpose: Define types of groups (e.g., classes, teams)
- Key Fields:
name: Group type namedescription: Description of the group typeis_active: Enable/disable group type- Usage: Create group types before creating groups
Groups¶
- Purpose: Manage cycling groups (classes, teams, etc.)
- Key Fields:
name: Group namegroup_type: Type of groupschool_name: Associated schooldistance_total: Total kilometers traveledis_active: Active status- Features:
- View aggregated mileage
- Track group progress
- Manage group hierarchy (parent/child groups)
Cyclists¶
- Purpose: Manage individual cyclists
- Key Fields:
user: Associated Django userid_tag: RFID tag identifiercoin_conversion_factor: Coins per kilometerdistance_total: Total kilometerscoins_total: Total coins earned- Features:
- Link cyclists to users
- Configure coin conversion
- View cycling statistics
Travel Tracks¶
- Purpose: Manage travel routes and tracks
- Key Fields:
name: Track namegpx_file: GPX route filedistance_km: Track distancemilestones: Associated milestones- Usage: Upload GPX files to create travel tracks
Milestones¶
- Purpose: Define milestones along travel tracks
- Key Fields:
name: Milestone nametravel_track: Associated trackposition_km: Position on trackis_locked: Lock status- Features:
- Track group progress toward milestones
- Award achievements
Events¶
- Purpose: Manage cycling events
- Key Fields:
name: Event namestart_date: Event startend_date: Event endgroups: Participating groups- Usage: Create and manage cycling events
IoT Management¶
Device and firmware management for ESP32 devices.
Devices¶
- Purpose: Manage ESP32 tachometer devices
- Key Fields:
name: Device identifierdisplay_name: Human-readable namegroup: Associated groupdistance_total: Total device mileagelast_active: Last activity timestamp- Features:
- Monitor device status
- View device statistics
- Configure device settings
Device Configurations¶
- Purpose: Server-side device configuration
- Key Fields:
device: Associated devicedevice_specific_api_key: Device API keysend_interval_seconds: Data transmission intervalwheel_size: Wheel circumference- Features:
- Configure device parameters remotely
- API key management
- Configuration synchronization
Firmware Images¶
- Purpose: Manage firmware versions for OTA updates
- Key Fields:
version: Firmware versionfile: Firmware binaryis_active: Active versionrelease_notes: Version notes- Usage: Upload firmware for automatic device updates
Device Health¶
- Purpose: Monitor device health status
- Key Fields:
device: Associated devicestatus: Health status (online/offline/warning/error)last_heartbeat: Last heartbeat timestampconsecutive_failures: Error count- Features:
- Real-time device monitoring
- Health status tracking
- Error reporting
MCC Game Interface¶
Game room and session management.
Game Rooms¶
- Purpose: Manage multiplayer game rooms
- Key Fields:
room_code: Unique room identifieris_active: Room statusmaster_session_key: Master sessiondevice_assignments: Cyclist-device mappings- Features:
- View active game rooms
- Monitor room activity
- Manage room state
Game Sessions¶
- Purpose: Track individual game sessions
- Key Fields:
session_key: Session identifierroom_code: Associated roomexpire_date: Session expiration- Features:
- Monitor active sessions
- Cleanup expired sessions
- Debug game state
Kiosk Management¶
Kiosk device and playlist management.
Kiosk Devices¶
- Purpose: Manage kiosk display devices
- Key Fields:
uid: Unique device identifiername: Device nameis_active: Active status- Usage: Configure kiosk displays
Historical Reports & Analytics¶
Analyses and reports for historical data.
Analytics Dashboard¶
- Purpose: Overview of analyses and statistics
- Features:
- Group statistics
- Mileage trends
- Time period analyses
- Export functions
- Access:
/admin/analytics/
Hierarchy Breakdown¶
- Purpose: Detailed breakdown of group hierarchy
- Features:
- Hierarchical display of groups
- Aggregated statistics per level
- Drill-down functionality
- Access:
/admin/analytics/hierarchy/
Session Management¶
Game session management and monitoring.
Session Dashboard¶
- Purpose: Overview of active and past game sessions
- Features:
- Display active sessions
- Monitor session status
- View session details
- Session management
- Access:
/admin/game/session/dashboard/
Mgmt (Management)¶
Server management and system monitoring.
Server Control¶
- Purpose: Server status and control
- Features:
- Display server status (running/stopped)
- Start, stop, restart server
- Display server metrics
- Health check status
- Display Gunicorn configuration
- Access:
/admin/server/or via "Mgmt" → "Server Control" - Permission: Superusers only
- Documentation: See Health Check API for details on external monitoring with monitoring systems
View Application Logs (Log File Viewer)¶
- Purpose: Display log files in browser
- Features:
- Select log files from
data/logs/directory (development) //data/var/mcc/logs/(production) - Real-time log display
- Browse rotated log files
- Filtering and search
- Auto-refresh function
- Access:
/admin/logs/or via "Mgmt" → "View Application Logs" - Permission: Superusers only
- Documentation:
- Display Log Files in Admin GUI - Overview of log files and using the Log File Viewer
- Production Logging Setup - Best practices for logging in production
Backup Management¶
- Purpose: Create and manage database backups
- Features:
- Manual backup creation
- Display backup list
- Backup download
- Backup information (size, date)
- Access:
/admin/backup/or via "Mgmt" → "Backup Management" - Permission: Superusers only
Gunicorn Configuration¶
- Purpose: Configure Gunicorn log level and worker configuration
- Key Fields:
log_level: Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)worker_class: Worker class (syncorgthread)workers: Number of worker processesthreads: Number of threads per worker (only withgthread)- Features:
- Change log level directly in Admin GUI
- Adjust worker configuration
- No environment variables needed
- Singleton model (only one instance)
- Access:
/admin/mgmt/gunicornconfig/or via "Mgmt" → "Gunicorn Configuration" - Note: Server restart required after changes
- Documentation:
- Gunicorn Configuration in Admin GUI - Overview of configuration in Admin Interface
- Gunicorn Worker Configuration - Details on worker classes, signal handler issues, and performance
Application Logs¶
Note: Logs are no longer stored in the database. Use the Log File Viewer (see above) instead to display log files.
Documentation: See Display Log Files in Admin GUI and Production Logging Setup for details on the logging system.
Request Logs¶
- Purpose: HTTP request logs for performance analysis
- Features:
- Display request duration
- Filter by status codes
- Endpoint analysis
- Performance metrics
- Access:
/admin/mgmt/requestlog/or via "Mgmt" → "Request Logs"
Performance Metrics¶
- Purpose: Monitor system performance metrics
- Features:
- CPU and memory statistics
- Request throughput
- Response times
- Trend analysis
- Access:
/admin/mgmt/performancemetric/or via "Mgmt" → "Performance Metrics"
Alert Rules¶
- Purpose: Configure alert rules for performance monitoring
- Features:
- Define thresholds
- Configure alert conditions
- Set up notifications
- Access:
/admin/mgmt/alertrule/or via "Mgmt" → "Alert Rules"
Maintenance Control¶
- Purpose: Activate/deactivate maintenance mode and configure IP whitelist
- Features:
- Activate/deactivate maintenance mode
- Configure IP whitelist (single IPs and CIDR blocks)
- Allow/deny admin access during maintenance
- Display current status
- Check IP status (whether current IP is in whitelist)
- Access:
/admin/maintenance/or via "Mgmt" → "Maintenance Control" - Permission: Superusers only
- Documentation: See Maintenance Mode Setup for details on configuration, IP whitelist, and Apache integration.
Maintenance Configuration¶
- Purpose: Configure IP whitelist and admin access
- Key Fields:
ip_whitelist: IP addresses or CIDR blocks (one per line)allow_admin_during_maintenance: Allow admin access for superusers- Access:
/admin/mgmt/maintenanceconfig/or via "Mgmt" → "Maintenance Configurations" - Permission: Superusers only
- Documentation: See Maintenance Mode Setup for details on IP whitelist configuration.
Minecraft Management¶
Minecraft server management (if enabled).
Minecraft Control¶
- Purpose: Minecraft worker status and control
- Features:
- Display worker status (Minecraft Bridge Worker and Snapshot Worker)
- Start, stop, restart workers
- Manage coin synchronization between MyCyclingCity and Minecraft server
- View and manage outbox events
- Test RCON connection
- Trigger manual synchronization
- Access:
/admin/minecraft/or via "Minecraft Management" → "Minecraft Control" - Permission: Superusers only
- Note: The worker synchronizes coins between the Django database and the Minecraft server via RCON. It does not control the Minecraft server itself.
- Documentation: See Minecraft Integration for details on coin synchronization, RCON communication, outbox pattern, and configuration.
Common Tasks¶
Creating a New Cyclist¶
- Navigate to MCC Core API & Models → Cyclists
- Click Add Cyclist
- Fill in required fields:
user: Select or create Django userid_tag: Enter RFID tag IDcoin_conversion_factor: Set coins per kilometer- Click Save
Assigning a Device to a Group¶
- Navigate to IoT Management → Devices
- Select the device
- In the Group field, select the target group
- Click Save
Uploading Firmware¶
- Navigate to IoT Management → Firmware Images
- Click Add Firmware Image
- Fill in:
version: Version number (e.g., "1.2.3")file: Upload firmware binary (.bin)is_active: Check if this is the active versionrelease_notes: Describe changes- Click Save
Configuring Device Settings¶
- Navigate to IoT Management → Device Configurations
- Select or create configuration for a device
- Configure:
send_interval_seconds: How often device sends datawheel_size: Wheel circumference in cmdevice_specific_api_key: Device authentication key- Click Save
Viewing Device Health¶
- Navigate to IoT Management → Device Health
- View status for all devices:
- Green: Online and healthy
- Yellow: Warning (no recent activity)
- Red: Error or offline
- Click on a device to see detailed health information
Managing Game Rooms¶
- Navigate to MCC Game Interface → Game Rooms
- View all active and inactive rooms
- Click on a room to:
- View room state
- See participants
- Monitor game progress
- End room if needed
Advanced Features¶
Bulk Actions¶
Many admin pages support bulk actions: 1. Select multiple items using checkboxes 2. Choose an action from the dropdown 3. Click Go
Filtering and Search¶
- List Filters: Use sidebar filters to narrow results
- Search: Use search boxes to find specific items
- Date Hierarchy: Click date links to filter by time period
Inline Editing¶
Some models support inline editing: - Edit related objects directly from the parent object - Add new related objects without leaving the page
Custom Actions¶
Some models have custom admin actions: - Delete Sessions: Bulk delete game sessions - Export Data: Export model data to CSV/JSON - Cleanup: Remove expired or orphaned records
Common Administrative Tasks¶
Restart Server¶
- Navigate to Mgmt → Server Control
- Check current server status
- Click Restart Server
- Wait until restart is complete
View Log Files¶
- Navigate to Mgmt → View Application Logs
- Select a log file from the dropdown menu
- The log file is automatically updated (Auto-Refresh)
- Use the search function to find specific entries
Create Backup¶
- Navigate to Mgmt → Backup Management
- Click Create Backup
- Wait until backup is created
- Download the backup if needed
Change Gunicorn Log Level¶
- Navigate to Mgmt → Gunicorn Configuration
- Select the desired log level
- Click Save
- Important: Restart the server (see "Restart Server")
View Analytics¶
- Navigate to Historical Reports & Analytics → Analytics Dashboard
- Select the desired time period
- Select the groups to analyze
- Export data if needed
Monitor Session Status¶
- Navigate to Session Management → Session Dashboard
- View all active sessions
- Click on a session to view details
- End sessions if needed
Best Practices¶
- Regular Backups: Always backup before bulk operations
- Test Changes: Test configuration changes on a development system first
- Monitor Health: Regularly check Device Health status
- Cleanup: Periodically clean up expired sessions and old data
- Documentation: Document custom configurations and changes
Troubleshooting¶
Cannot Access Admin¶
- Verify you're logged in as a superuser
- Check
ALLOWED_HOSTSin settings - Ensure
DEBUG=Truein development
Changes Not Saving¶
- Check for validation errors (red text)
- Verify required fields are filled
- Check database permissions
Device Not Appearing¶
- Verify device is registered in Devices
- Check Device Health status
- Ensure device has sent at least one heartbeat
Related Documentation¶
- Installation Guide
- Configuration Guide
- API Reference
- Production Deployment Checklist - Checklist for production deployments
- Compile Translations - Guide for compiling translations without venv libraries
- Maintenance Mode Setup - Configure maintenance mode with IP whitelist and admin access