state file content value is not 0|1
HT-Moh opened this issue · comments
This issue caused by empty line at the end of the file maintance_mode_state.txt which can be added by pre-commit hooks or the IDE
python3.8/site-packages/maintenance_mode/backends.py", line 22, in get_value
raise ValueError('state file content value is not 0|1')
Solution add strip strip()
class LocalFileBackend(AbstractStateBackend):
def get_value(self):
value = read_file(settings.MAINTENANCE_MODE_STATE_FILE_PATH, '0')
if value.strip() not in ['0', '1']:
raise ValueError('state file content value is not 0|1')
value = bool(int(value))
return value
@HT-Moh thank you for reporting this.
@HT-Moh you can install 0.15.1
version.