File size: 1,306 Bytes
			
			25f22bf 2a7e4f1 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 25f22bf 1d6d1e6 2a7e4f1 1d6d1e6 25f22bf 1d6d1e6 25f22bf  | 
								1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47  | 
								#!/usr/bin/env python
"""
Entry point for the Lin application.
This script starts the Flask application with APScheduler.
"""
import os
import sys
from pathlib import Path
if __name__ == "__main__":
    # Set the port for Hugging Face Spaces
    port = os.environ.get('PORT', '7860')
    os.environ.setdefault('PORT', port)
    
    print(f"Starting Lin application on port {port}...")
    print("=" * 60)
    
    try:
        # Import and run the backend Flask app directly
        from backend.app import create_app
        app = create_app()
        
        print("=" * 60)
        print("Flask application starting...")
        print("Access the application at:")
        print(f"  http://localhost:{port}")
        print(f"  http://127.0.0.1:{port}")
        print("=" * 60)
        
        app.run(
            host='0.0.0.0',
            port=int(port),
            debug=False,
            threaded=True
        )
        
    except KeyboardInterrupt:
        print("\nShutting down application...")
        # Shutdown scheduler if it exists
        if hasattr(app, 'scheduler'):
            app.scheduler.shutdown()
        sys.exit(0)
    except Exception as e:
        print(f"Failed to start Lin application: {e}")
        import traceback
        traceback.print_exc()
        sys.exit(1) |