It appears that the repository has undergone several changes and renamings:
This commit is contained in:
@@ -18,6 +18,7 @@ import os
|
||||
import sys
|
||||
import ssl
|
||||
import logging
|
||||
import platform
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Füge App-Verzeichnis zum Python-Pfad hinzu
|
||||
@@ -73,7 +74,12 @@ app.config.from_object(ProductionConfig)
|
||||
def setup_production_ssl():
|
||||
"""Stelle sicher, dass browser-kompatible SSL-Zertifikate vorhanden sind"""
|
||||
|
||||
ssl_dir = '/opt/myp/ssl'
|
||||
# Plattform-spezifische SSL-Pfade
|
||||
if platform.system() == 'Windows':
|
||||
ssl_dir = os.path.join(os.path.dirname(__file__), 'ssl')
|
||||
else:
|
||||
ssl_dir = '/opt/myp/ssl'
|
||||
|
||||
cert_file = f'{ssl_dir}/cert.pem'
|
||||
key_file = f'{ssl_dir}/key.pem'
|
||||
|
||||
@@ -330,17 +336,19 @@ def main():
|
||||
try:
|
||||
app_logger.info("🚀 MYP Produktions-Server startet...")
|
||||
app_logger.info(f"📅 Start-Zeit: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
app_logger.info(f"🖥️ Hostname: {os.uname().nodename}")
|
||||
app_logger.info(f"🖥️ Hostname: {platform.node()}")
|
||||
app_logger.info(f"🐍 Python: {sys.version}")
|
||||
|
||||
# Produktions-Logging einrichten
|
||||
setup_production_logging()
|
||||
|
||||
# Prüfe Root-Berechtigung für Port 443
|
||||
if os.geteuid() != 0:
|
||||
# Prüfe Root-Berechtigung für Port 443 (nur Unix/Linux)
|
||||
if hasattr(os, 'geteuid') and os.geteuid() != 0:
|
||||
app_logger.error("❌ Root-Berechtigung erforderlich für Port 443")
|
||||
app_logger.error("💡 Führe aus mit: sudo python3 app_production.py")
|
||||
sys.exit(1)
|
||||
elif platform.system() == 'Windows':
|
||||
app_logger.info("🪟 Windows-Modus: Root-Check übersprungen")
|
||||
|
||||
# SSL-Kontext erstellen
|
||||
ssl_context = get_production_ssl_context()
|
||||
@@ -382,7 +390,10 @@ def main():
|
||||
|
||||
except PermissionError:
|
||||
app_logger.error("❌ Berechtigung verweigert für Port 443")
|
||||
app_logger.error("💡 Führe aus mit: sudo python3 app_production.py")
|
||||
if platform.system() != 'Windows':
|
||||
app_logger.error("💡 Führe aus mit: sudo python3 app_production.py")
|
||||
else:
|
||||
app_logger.error("💡 Führe als Administrator aus")
|
||||
sys.exit(1)
|
||||
|
||||
except OSError as e:
|
||||
|
Reference in New Issue
Block a user