Python version
3.10
Django version
4.2.0
Package version
latest from GIT
Current behavior (bug description)
maintenance_mode_state.txt file gets deleted from directory
Expected behavior
maintenance_mode_state.txt file should be stay
Problem under Windows is that the atomic mode is not working. Therefore I have added a switch checking for the platform and either using atomic or non_atomic write.
In the write_file routine the same problem exists.
Have changed io.py accordingly.
import fsutil
import platform
def read_file(file_path, default_content=""):
"""
Read file at the specified path.
If file doesn't exist, it will be created with default-content.
Returns the file content.
"""
if not fsutil.exists(file_path):
fsutil.write_file(file_path, default_content, atomic=False if platform.system() == 'Windows' else True)
return fsutil.read_file(file_path) or default_content
def write_file(file_path, content):
"""
Write file at the specified path with content.
If file exists, it will be overwritten.
"""
fsutil.write_file(file_path, content, atomic=False if platform.system() == 'Windows' else True)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too