Skip to content

Add environment information to admin dashboard

🎯 Implements Issue #1

Adds a comprehensive admin dashboard route that displays Python, Flask, and system environment information for debugging purposes.

📋 Changes Made

🔧 Core Functionality

  • Fixed critical import bug: Corrected import oskimport sys typo
  • Enhanced /admin/system route: Added comprehensive environment information
  • Added system metrics: CPU, memory, disk usage with visual indicators
  • Python 3 binary detection: Automatic detection with graceful error handling

🎨 User Interface

  • Created responsive template: templates/admin_system_info.html
  • Added navigation: "System Info" button in main admin panel
  • Professional design: Bootstrap cards with color-coded sections
  • Visual progress bars: For memory and disk usage
  • Mobile-friendly: Responsive layout

📊 Information Displayed

  • Python Runtime: Version, executable path, platform details
  • Flask Framework: Versions, debug mode, configuration status
  • Server Metrics: CPU cores, memory usage, disk statistics
  • System Information: OS, architecture, processor details
  • Process Information: PID, resource usage, thread count
  • Environment: Virtual environment detection, Flask settings
  • Packages: Installed Python packages with versions

🛠️ Technical Improvements

  • Added dependency: psutil==5.9.5 for system metrics
  • Custom template filter: Timestamp to readable date conversion
  • Enhanced error handling: Graceful fallbacks for unavailable information
  • Security conscious: No sensitive credential exposure

Testing

  • Added test coverage: New test for system info route
  • All tests passing: 23/23 tests successful
  • Verified functionality: Application starts and runs correctly

🔍 Testing Instructions

  1. Install dependencies: pip3 install -r requirements.txt
  2. Run application: python3 run.py
  3. Access system info: http://127.0.0.1:5000/admin/system
  4. Run tests: python3 -m pytest tests/ -v

📸 Key Features

  • Debugging focused: Essential information for troubleshooting
  • Professional UI: Consistent with existing admin interface
  • Performance metrics: Real-time system usage information
  • Python 3 compliant: Follows development style guide
  • Comprehensive coverage: All requested information included

Closes #1

Merge request reports

Loading