diff --git a/src/backend/InvenTree/InvenTree/ready.py b/src/backend/InvenTree/InvenTree/ready.py index 702336174a..9129d37697 100644 --- a/src/backend/InvenTree/InvenTree/ready.py +++ b/src/backend/InvenTree/InvenTree/ready.py @@ -6,6 +6,8 @@ import os import sys import warnings +from django.conf import settings + import structlog logger = structlog.get_logger('inventree') @@ -59,7 +61,13 @@ def isRunningMigrations(): def isRebuildingData(): """Return true if any of the rebuilding commands are being executed.""" return any( - x in sys.argv for x in ['rebuild_models', 'rebuild_thumbnails', 'rebuild'] + x in sys.argv + for x in [ + 'rebuild', + 'rebuild_models', + 'rebuild_thumbnails', + 'remove_stale_contenttypes', + ] ) @@ -104,9 +112,12 @@ def isGeneratingSchema(): if not result: # We should only get here if we *are* generating schema # Any other time this is called, it should be from a server thread, worker thread, or test mode - logger.warning( - 'isGeneratingSchema called outside of expected contexts - this may be a sign of a problem with the ready() function' - ) + + if settings.DEBUG: + logger.warning( + 'isGeneratingSchema called outside of expected contexts - this may be a sign of a problem with the ready() function' + ) + logger.warning('sys.argv: %s', sys.argv) return result