Comments (11)
- I can't imagine this to work for class based views.
- The list could be really long. In such case, the decorator would be much easier to maintain.
from django-maintenance-mode.
This is a very useful feature. Thanks for the suggestion, I will work on it as soon as possible.
from django-maintenance-mode.
If you don't insist on writing it yourself, I should be able to find time to do it next week.
from django-maintenance-mode.
If you can write it with tests it would be great.
By default all views are affected by maintenance-mode when active, so my idea is to add a single decorator named ignore_maintenance_mode
.
from django-maintenance-mode.
That's only true if middleware is turned on. Some of our use cases requires only few views to be turned on, while most of the application is not affected by the middleware. My original idea was to add possitive decorator.
But I see you case, so I suggest to add both decorators - force and ignore, similarly to CSRF in Django itself.
from django-maintenance-mode.
So you need to have some views under a forced maintenance-mode also if the maintenance-mode is not set to True, is it correct?
from django-maintenance-mode.
Nope, we need only a few views to be subject of the maintenance mode, while most of them is not affected. Thus we want to decorate those views and avoid usage of the middleware.
from django-maintenance-mode.
By default all views are affected by maintenance-mode when active, so my idea is to add a single decorator named
ignore_maintenance_mode
(to avoid usage of the middleware for the views that must not be affected by maintenance-mode)
I think we are saying the same thing...
from django-maintenance-mode.
I think that the best approach would be add a new setting:
MAINTENANCE_MODE_IGNORE_VIEWS = ('app.views.no_maintenance_mode', )
Have you any reason to prefere a view decorator?
from django-maintenance-mode.
Released 0.9.0
Now you can use force_maintenance_mode_on
and force_maintenance_mode_off
decorators.
from django-maintenance-mode.
Thanks, but force_maintenance_mode_on
seems somewhat ridiculous. It always enforces maintenance mode on a view, which I can't find any use for.
Instead such decorator should check maintenance mode, even if maintenance middleware is not active.
from django-maintenance-mode.
Related Issues (20)
- Add time window HOT 6
- If there some custom processor is using django request, it returns an error. HOT 12
- Add banner for informate user hours and date of the maintenance HOT 3
- 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.