mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Clear the SERVER_RESTART_REQUIRED flag automatically when the server reloads
This commit is contained in:
		@@ -1,10 +1,30 @@
 | 
				
			|||||||
# -*- coding: utf-8 -*-
 | 
					# -*- coding: utf-8 -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from django.apps import AppConfig
 | 
					from django.apps import AppConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					logger = logging.getLogger('inventree')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CommonConfig(AppConfig):
 | 
					class CommonConfig(AppConfig):
 | 
				
			||||||
    name = 'common'
 | 
					    name = 'common'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def ready(self):
 | 
					    def ready(self):
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        self.clear_restart_flag()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def clear_restart_flag(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Clear the SERVER_RESTART_REQUIRED setting
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
 | 
					            import common.models
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED'):
 | 
				
			||||||
 | 
					                logger.info("Clearing SERVER_RESTART_REQUIRED flag")
 | 
				
			||||||
 | 
					                common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
 | 
				
			||||||
 | 
					        except:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user