| |
| """ |
| 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__": |
| |
| port = os.environ.get('PORT', '7860') |
| os.environ.setdefault('PORT', port) |
| |
| print(f"Starting Lin application on port {port}...") |
| print("=" * 60) |
| |
| try: |
| |
| 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...") |
| |
| 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) |