Comments (6)
@stanim I have this feature in mind since long time, but actually I have not time to implement it, so I share with you my idea in case you want to send a PR:
MAINTENANCE_MODE_SCHEDULE={
'mon': {
'on': '03:00',
'off': '03:30',
},
'tue': {
'on': '14:30',
'off': '14:45',
},
# for each day, or use * for all days
}
I would add support to a new setting like this one, what do you think about it?
from django-maintenance-mode.
The problem is that the business needs to be able to configure this from a webview. So Django settings are no solution, as settings are supposed to be immutable. Would it be possible to store the settings in the maintenance lock file?
from django-maintenance-mode.
I understand your needs, but it seems a specific case. The maintenance state file is not for this, you should write a custom state backend that return values based on the configuration done in the webview.
Check MAINTENANCE_MODE_STATE_BACKEND
setting in the README.
from django-maintenance-mode.
@stanim check #66 if you are interested to implement a quick schedule system by @scwall using the backend/database, or check #48 if you need to control maintenance mode state using the admin.
from django-maintenance-mode.
I use https://django-constance.readthedocs.io/en/latest/ for configuring stuff like this. For example:
CONSTANCE_CONFIG = {
"MAINTENANCE_ENABLED": (False, "Maintenance mode is enabled", bool),
"MAINTENANCE_END": (datetime(2023, 11, 7, 11), "Maintenance mode end", datetime),
}
So you just need to implement MAINTENANCE_MODE_STATE_BACKEND as mentioned before to use this setting.
@fabiocaccamo Maybe you want to add this backend to your package, so people can choose the bundled backend if they use Constance?
from django-maintenance-mode.
@miklevtsov of which backend are you talking about?
I think that this should be managed at settings level as described here #66 (comment) and also that any backend implementation would be too specific.
from django-maintenance-mode.
Related Issues (20)
- Add new setting to expire the user session HOT 4
- ModuleNotFoundError: 'utils.middleware.maintenance' While running testcases HOT 1
- Add Django Cache Backend HOT 2
- Reason and Service Timeline HOT 1
- Redirect on /maintenance-mode/on HOT 3
- Way to add subnets on ip addresses to ignore HOT 7
- state file content value is not 0|1 HOT 2
- Disable emailing 503 errors to admins while maintenance mode is enabled HOT 12
- Banner for all templates to warn users when maintenance will be HOT 1
- 404 Not Found Error When SCRIPT_NAME Defined HOT 10
- FileNotFoundError with default settings HOT 1
- IGNORE_IP not working HOT 6
- CommandError: Unable to write state file at: maintenance_mode_state.txt HOT 1
- Working fine on dev box but not functioning on test box with virtual directory HOT 11
- force_maintenance_mode_off doesn't work for AJAX requests HOT 1
- Problem with ipware version HOT 1
- Unable to use with s3 storage HOT 4
- Add maintenance mode toggler in the admin site HOT 1
- MAINTENANCE_MODE_STATE_FILE_PATH setting bug HOT 2
- Drop `Python < 3.8` and `Django < 2.2` support.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-maintenance-mode.