I've created a maintenance mode by modifying the WSGIApplication.
My main.py
now looks like this:
import webapp2
import views
maintenance_mode = False
# These routes need to be always available
routes = [
# Static pages
(r'/(|about|contact|help|faq|terms|privacy|users|methods)',
views.Static),
# Other routes that should always be available here
]
if maintenance_mode:
routes += [(r'/.*', views.Maintenance)] # Displays a maintenance message
application = webapp2.WSGIApplication(routes)
else:
routes += [
# Routes that are not available in maintenance mode
]
application = webapp2.WSGIApplication(routes)
views.py
has the following:
class Maintenance(webapp2.RequestHandler):
def get(self):
self.response.write (
"My app is down for maintenance and should be back up shortly.")
def post(self):
self.response.write (
"My app is down for maintenance and should be back up shortly.")
This seems like an easy and safe solution, but please let me know if you seen any flaws in this approach.