fabiocaccamo/django-maintenance-mode

FileNotFoundError on MAINTENANCE_MODE_STATE_FILE_PATH

jibusayone opened this issue · 1 comments

When I don't specify MAINTENANCE_MODE_STATE_FILE_PATH in settings.py and try to turn off maintenance mode, it results in:
FileNotFoundError: [Errno 2] No such file or directory: '/project/settings/maintenance_mode_state.txt'

In the docs, it's said that:
By default, a file named maintenance_mode_state.txt will be created in the maintenance_mode directory, and that we can customize the state file path in case the default one is not writable.

For me, that directory was writable, but still maintenance_mode_state.txt file got created in the same folder of my settings.py file. And the above error is thrown.

To fix the issue on my end, I had to explicitly specify
MAINTENANCE_MODE_STATE_FILE_PATH = 'maintenance_mode_state.txt' in my settings.py
and add maintenance_mode_state.txt to gitignore.

@jibusayone I will just fix the documentation.
The best location for the state file is next to the default settings file, this has been discussed here: #32
If you need something different just specify a custom location or consider also the possibility to use a custom backend.