87 lines
2.7 KiB
Python
87 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
MYP Druckerverwaltung - SINGLE ENTRY POINT
|
|
==========================================
|
|
|
|
Diese Datei ist der EINZIGE Einstiegspunkt für das MYP-System.
|
|
Sie verwendet immer die korrekte und aktuellste App-Konfiguration.
|
|
|
|
VERWENDUNG:
|
|
- Development: python START_SERVER.py
|
|
- Production: sudo python START_SERVER.py --production
|
|
- Mit SSL: python START_SERVER.py --ssl
|
|
|
|
Dies ersetzt alle anderen App-Dateien und sorgt für Konsistenz.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import platform
|
|
from datetime import datetime
|
|
|
|
print("=" * 60)
|
|
print("🚀 MYP DRUCKERVERWALTUNG - UNIFIED STARTER")
|
|
print("=" * 60)
|
|
print(f"📅 Start-Zeit: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
print(f"💻 Plattform: {platform.system()} {platform.release()}")
|
|
print(f"🐍 Python: {sys.version}")
|
|
print()
|
|
|
|
# Bestimme Betriebsmodus
|
|
production_mode = '--production' in sys.argv or '--prod' in sys.argv
|
|
ssl_mode = '--ssl' in sys.argv or '--https' in sys.argv or production_mode
|
|
|
|
print(f"🎯 Modus: {'🏭 PRODUCTION' if production_mode else '🔧 DEVELOPMENT'}")
|
|
print(f"🔐 SSL: {'✅ AKTIVIERT' if ssl_mode else '❌ DEAKTIVIERT'}")
|
|
print()
|
|
|
|
# Warnung für Production-Modus
|
|
if production_mode:
|
|
print("⚠️ PRODUKTIONS-MODUS AKTIVIERT")
|
|
print(" - HTTPS-Only (Port 443)")
|
|
print(" - SSL-Zertifikate erforderlich")
|
|
print(" - Root-Berechtigung erforderlich (Linux)")
|
|
print()
|
|
|
|
# Importiere und starte die Haupt-App
|
|
try:
|
|
print("📦 Lade MYP-System...")
|
|
|
|
# Verwende immer app.py als einzige Quelle
|
|
from app import main as start_app
|
|
|
|
print("✅ MYP-System erfolgreich geladen")
|
|
print("🚀 Server wird gestartet...")
|
|
print("=" * 60)
|
|
print()
|
|
|
|
# Starte die App
|
|
start_app()
|
|
|
|
except KeyboardInterrupt:
|
|
print()
|
|
print("🛑 Server durch Benutzer gestoppt (Strg+C)")
|
|
sys.exit(0)
|
|
|
|
except ImportError as e:
|
|
print(f"❌ FEHLER: MYP-System konnte nicht geladen werden")
|
|
print(f" Details: {e}")
|
|
print()
|
|
print("💡 LÖSUNGSVORSCHLÄGE:")
|
|
print(" 1. Stelle sicher, dass alle Abhängigkeiten installiert sind:")
|
|
print(" pip install -r requirements.txt")
|
|
print(" 2. Prüfe, ob app.py existiert und funktional ist")
|
|
print(" 3. Führe das System im Backend-Verzeichnis aus")
|
|
sys.exit(1)
|
|
|
|
except Exception as e:
|
|
print(f"❌ KRITISCHER FEHLER beim Start: {e}")
|
|
print()
|
|
print("💡 FEHLERBEHEBUNG:")
|
|
print(" 1. Prüfe die Log-Dateien für Details")
|
|
print(" 2. Stelle sicher, dass die Datenbank erreichbar ist")
|
|
print(" 3. Bei SSL-Problemen: Starte ohne --ssl")
|
|
import traceback
|
|
print(f" Debug-Info: {traceback.format_exc()}")
|
|
sys.exit(1) |