44
55app = create_app ()
66
7+ if app : # Ensure app object was created successfully
8+ # Import log_system_event if it's not already imported at the top of run.py
9+ # Assuming it might not be, let's add a local import for safety.
10+ from app .core .logging import log_system_event
11+ with app .app_context ():
12+ log_system_event ('application_ready' , 'CoreSecFrame application initialized successfully' )
13+
714def is_wsl_environment ():
815 """Detects if the app is running in a WSL environment"""
916 try :
@@ -13,26 +20,8 @@ def is_wsl_environment():
1320 except Exception :
1421 return False
1522
16- def start_novnc_service ():
17- """Starts the noVNC systemd service if it's not already running"""
18- try :
19- # Check if service is active
20- status = subprocess .run (
21- ["systemctl" , "is-active" , "--quiet" , "novnc.service" ]
22- )
23- if status .returncode != 0 :
24- print ("ℹ️ Starting noVNC service via systemd..." )
25- subprocess .run (["sudo" , "systemctl" , "start" , "novnc.service" ])
26- else :
27- print ("✅ noVNC service already running" )
28- except Exception as e :
29- print (f"❌ Failed to check/start noVNC service: { e } " )
30-
3123if __name__ == '__main__' :
32- if not is_wsl_environment ():
33- print ("🖥️ Native Linux detected. Ensuring noVNC service is running..." )
34- start_novnc_service ()
35- else :
36- print ("💡 WSL environment detected. Skipping noVNC systemd service startup." )
37-
38- socketio .run (app , debug = False , host = '0.0.0.0' )
24+ # The logic for starting noVNC service has been removed.
25+ # is_wsl_environment() function remains if needed elsewhere,
26+ # or can be removed if this was its only use.
27+ socketio .run (app , debug = False , host = '0.0.0.0' , allow_unsafe_werkzeug = True )
0 commit comments