Maintenance mode¶
For a django (or bottle) webapp deployement you can set the webserver to be in maintenance mode before deploying. For that purpose you could import in your fabfile pydiploy.django.set_app_up and pydiploy.django.set_app_down in a task :
from pydiploy.django import (set_app_up as pydiploy_set_up, set_app_down as pydiploy_set_down) @roles('web_server_role') @task def set_down(): """ Set app to maintenance mode """ execute(pydiploy_set_down) @roles('web_server_role') @task def set_up(): """ Set app to up mode """ execute(pydiploy_set_up)Then you could call directly the new tasks to toggle between up and down mode a maintenance.html will be used rendered with a 503 http status
Toggle to maintenance mode and active maintenance page :
$ fab prod set_downWhen setting the site in maintenance mode you could customize title and text of the maintenance page :
fab prod set_down --set maintenance_title='Webapp is down !',maintenance_text='Time for maintenance, please come back later'If you want to permanently change the default maintenance page you could set env vars in fabfile :
# Put this somewhere in the fabfile env.maintenance_title='Webapp is down !' env.maintenance_text='Time for maintenance, please come back later'Toggle to up mode and deactivate maintenance page :
$ fab prod set_up

