straight55b / app-engine-patch

Automatically exported from code.google.com/p/app-engine-patch
0 stars 0 forks source link

Add maintenance mode switch in settings #183

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When switching from one version to a new version, it is often necessary to
go into a planned maintenance  mode to ensure that users do not make
changes to data that will break or complicate the migration process.

Attached is a maintenanceMode middleware class that is switchable with a
boolean setting in settings.py. It would be nice if it were included as
part of ragendja. It hooks into the maintenance view that is already used
if CapabilityDisabled is thrown. The class is largely from
http://code.google.com/p/django-maintenancemode/, but without all the other
infrastructure that project brings with it.

to use:
add this middleware (settings.py):    
'ragendja.middleware.MaintenanceModeMiddleware',
add this setting (settings.py): MAINTENANCE_MODE=False/True
add this handler (urls.py): handler503 = 'ragendja.views.maintenance'

Original issue reported on code.google.com by jricket...@gmail.com on 12 Jul 2009 at 10:36

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like a good addition. A few improvement suggestions:

Could you make the handler503 urls code optional. If it doesn't exist, the 
standard 
ragendja maintenance view should be used.

Also, if MAINTENANCE isn't specified in settings.py the middleware shouldn't 
fail 
(use getattr(settings, 'MAINTENANCE', None).

If you have time, would you like to add support for detecting App Engine 
maintenance 
via GAE's capability API? That way we could probably even notify the user when 
the 
maintenance will end.

Original comment by wkornew...@gmail.com on 12 Jul 2009 at 11:01

GoogleCodeExporter commented 9 years ago
re: getattr. Sure
re: make urls code optional. I am not sure how to do this. Can you point me at a
resource?
re: capability api. I haven't heard of this, and after doing a google search I 
can't
find it there either. Have you got a pointer to this too?

Original comment by jricket...@gmail.com on 12 Jul 2009 at 12:13

GoogleCodeExporter commented 9 years ago
re urls optional: Take a look at the source code of urlresolvers 
(_resolve_special). It 
will probably raise an AttributeError (in getattr()) if the handler hasn't been 
specified. You'll have to try.

re capability api: See the SDK's source in google.appengine.api.capabilities 
(in 
__init__.py, including docstrings).

Original comment by wkornew...@gmail.com on 13 Jul 2009 at 8:56

GoogleCodeExporter commented 9 years ago
Any news?

Original comment by wkornew...@gmail.com on 26 Jul 2009 at 12:08

GoogleCodeExporter commented 9 years ago
I have looked at it, but haven't done anything further on it yet. I will be 
looking
at it again shortly.

Original comment by jricket...@gmail.com on 27 Jul 2009 at 10:14