LR module possibly working
This commit is contained in:
109
test_minimal_dashboard.py
Normal file
109
test_minimal_dashboard.py
Normal file
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Minimal Dashboard Test - Debug startup issues
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
# Setup logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def test_imports():
|
||||
"""Test all required imports"""
|
||||
try:
|
||||
logger.info("Testing imports...")
|
||||
|
||||
# Core imports
|
||||
from core.config import get_config
|
||||
logger.info("✓ core.config imported")
|
||||
|
||||
from core.data_provider import DataProvider
|
||||
logger.info("✓ core.data_provider imported")
|
||||
|
||||
# Dashboard imports
|
||||
import dash
|
||||
from dash import dcc, html
|
||||
import plotly.graph_objects as go
|
||||
logger.info("✓ Dash imports successful")
|
||||
|
||||
# Try to import the dashboard
|
||||
from web.scalping_dashboard import RealTimeScalpingDashboard
|
||||
logger.info("✓ RealTimeScalpingDashboard imported")
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Import error: {e}")
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
def test_dashboard_creation():
|
||||
"""Test dashboard creation"""
|
||||
try:
|
||||
logger.info("Testing dashboard creation...")
|
||||
|
||||
from web.scalping_dashboard import RealTimeScalpingDashboard
|
||||
from core.data_provider import DataProvider
|
||||
|
||||
# Create data provider
|
||||
data_provider = DataProvider()
|
||||
logger.info("✓ DataProvider created")
|
||||
|
||||
# Create dashboard
|
||||
dashboard = RealTimeScalpingDashboard(data_provider=data_provider)
|
||||
logger.info("✓ Dashboard created successfully")
|
||||
|
||||
return dashboard
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Dashboard creation error: {e}")
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
def test_dashboard_run():
|
||||
"""Test dashboard run"""
|
||||
try:
|
||||
logger.info("Testing dashboard run...")
|
||||
|
||||
dashboard = test_dashboard_creation()
|
||||
if not dashboard:
|
||||
return False
|
||||
|
||||
# Try to run dashboard
|
||||
logger.info("Starting dashboard on port 8052...")
|
||||
dashboard.run(host='127.0.0.1', port=8052, debug=True)
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Dashboard run error: {e}")
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Main test function"""
|
||||
logger.info("=== MINIMAL DASHBOARD TEST ===")
|
||||
|
||||
# Test 1: Imports
|
||||
if not test_imports():
|
||||
logger.error("Import test failed!")
|
||||
sys.exit(1)
|
||||
|
||||
# Test 2: Dashboard creation
|
||||
dashboard = test_dashboard_creation()
|
||||
if not dashboard:
|
||||
logger.error("Dashboard creation test failed!")
|
||||
sys.exit(1)
|
||||
|
||||
# Test 3: Dashboard run
|
||||
logger.info("All tests passed! Starting dashboard...")
|
||||
test_dashboard_run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user