classStatReloader(BaseReloader):
SLEEP_TIME =1# Check for changes once per second.deftick(self):
mtimes ={}whileTrue:for filepath, mtime in self.snapshot_files():# old_time = mtimes.get(filepath)# mtimes[filepath] = mtime# if old_time is None:# logger.debug("File %s first seen with mtime %s", filepath, mtime)# continuefrom django.conf import settings
for _ in settings.NO_MONITOR:ifstr(filepath)instr(_):
old_time =Falseelse:
old_time = mtimes.get(filepath)
mtimes[filepath]= mtime
if old_time isNone:
logger.debug("File %s first seen with mtime %s", filepath, mtime)continueelif old_time isFalse:
logger.debug("文件 %s 是自定义排除的", filepath)continue