@@ -78,10 +78,6 @@ def initialize(self):
7878        self .registerVtkWebProtocol (publisher )
7979        self .setSharedObject ("db" , dict ())
8080        self .setSharedObject ("publisher" , publisher )
81-         db_path  =  os .environ .get ("DATABASE_PATH" )
82-         if  db_path :
83-             db_full_path  =  os .path .join (db_path , "project.db" )
84-             connection .init_database (db_full_path )
8581
8682        # Custom API 
8783        mesh_protocols  =  VtkMeshView ()
@@ -149,9 +145,20 @@ def run_server(Server=_Server):
149145        if  not  args .database_path :
150146            args .database_path  =  args .data_folder_path 
151147            os .environ ["DATABASE_PATH" ] =  args .data_folder_path 
148+         else :
149+             os .environ ["DATABASE_PATH" ] =  args .database_path 
150+ 
151+     db_path  =  os .environ .get ("DATABASE_PATH" )
152+     if  db_path :
153+         db_full_path  =  os .path .join (db_path , "project.db" )
154+         connection .init_database (db_full_path )
155+         print (f"Viewer database initialized at: { db_full_path }  " , flush = True )
156+     else :
157+         print ("WARNING: No DATABASE_PATH set, database not initialized!" , flush = True )
152158
153159    print (f"{ args = }  " , flush = True )
154160    Server .configure (args )
161+ 
155162    server .start_webserver (options = args , protocol = Server )
156163
157164
0 commit comments