
from django.apps import AppConfig


class CommonConfig(AppConfig):
    name = 'common'

    def ready(self):
        pass


import logging

from django.apps import AppConfig


logger = logging.getLogger('inventree')


class CommonConfig(AppConfig):
    name = 'common'

    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

Clear the SERVER_RESTART_REQUIRED flag automatically when the server reloads
Clear the SERVER_RESTART_REQUIRED flag automatically when the server reloads

+ 
+ import logging
  
  from django.apps import AppConfig
+ 
+ 
+ logger = logging.getLogger('inventree')
  
  
  class CommonConfig(AppConfig):
      name = 'common'
  
      def ready(self):
-         pass
+         
+         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
+ 
Clear the SERVER_RESTART_REQUIRED flag automatically when the server reloads
## Code Before:

from django.apps import AppConfig


class CommonConfig(AppConfig):
    name = 'common'

    def ready(self):
        pass

## Instruction:
Clear the SERVER_RESTART_REQUIRED flag automatically when the server reloads
## Code After:

import logging

from django.apps import AppConfig


logger = logging.getLogger('inventree')


class CommonConfig(AppConfig):
    name = 'common'

    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
