I wanted to share this process that I’ve figured out since I
couldn’t find a solid answer anywhere online, I hope it helps someone
and saves them time and headaches. The problem, “How to put your Django site into maintenance mode” – the easy way with Fabric.
Truth be told I figured this out by combining info from How to use mod_rewrite rules to easily enable web site “maintenance” modes by Meitar Moscovitz this article pointed me in the right direction.
1. First make sure you create a empty file on your server, this will
be your toggle file (or at least this is what I call it). We’ll use this
to check whether or not the maintenance mode is on or off.
In this case I created a file called “maintenance-mode-on” and put it
in on my server that’s serving the static content for my Django site.
2. In your .htaccess or httpd.conf file add this,
3. Once that’s done you can now create two new Fabric commands;
And presto that’s it, you can now put your site into maintenance mode, make the necessary changes and database backups or whatever, without having to worry that users are still in or on the site.