• Stars
    star
    178
  • Rank 214,900 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 13 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ›  django-maintenancemode allows you to temporary shutdown your site for maintenance work

django-maintenancemode

https://app.travis-ci.com/bashu/django-maintenancemode.svg?branch=develop https://coveralls.io/repos/github/shanx/django-maintenancemode/badge.svg?branch=develop

django-maintenancemode is a middleware that allows you to temporary shutdown your site for maintenance work.

Logged in users having staff credentials can still fully use the site as can users visiting the site from an IP address defined in Django's INTERNAL_IPS.

Authored by Remco Wendt, and some great contributors.

How it works

maintenancemode works the same way as handling 404 or 500 error in Django work. It adds a handler503 which you can override in your main urls.py or you can add a 503.html to your templates directory.

  • If user is logged in and staff member, the maintenance page is not displayed.

  • If user's IP is in INTERNAL_IPS, the maintenance page is not displayed.

  • To override the default view which is used if the maintenance mode is enabled you can simply define a handler503 variable in your ROOT_URLCONF, similar to how you would customize other error handlers, e.g. :

    handler503 = 'example.views.maintenance_mode'

Installation

  1. Either checkout maintenancemode from GitHub, or install using pip :

    pip install django-maintenancemode
  2. Add maintenancemode to your INSTALLED_APPS :

    INSTALLED_APPS = (
        ...
        'maintenancemode',
    )
  3. Add MaintenanceModeMiddleware to MIDDLEWARE_CLASSES, make sure it comes after AuthenticationMiddleware :

    MIDDLEWARE_CLASSES = (
        ...
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'maintenancemode.middleware.MaintenanceModeMiddleware',
    )
  4. Add variable called MAINTENANCE_MODE in your project's settings.py file :

    MAINTENANCE_MODE = True  # Setting this variable to ``True`` activates the middleware.

    or set MAINTENANCE_MODE to False and use maintenance command :

    python ./manage.py maintenance <on|off>

Please see example application. This application is used to manually test the functionalities of this package. This also serves as a good example...

You need only Django 1.4 or above to run that. It might run on older versions but that is not tested.

Configuration

There are various optional configuration options you can set in your settings.py

# Enable / disable maintenance mode.
# Default: False
MAINTENANCE_MODE = True  # or ``False`` and use ``maintenance`` command

# Sequence of URL path regexes to exclude from the maintenance mode.
# Default: ()
MAINTENANCE_IGNORE_URLS = (
    r'^/docs/.*',
    r'^/contact'
)

License

django-maintenancemode is released under the BSD license.

More Repositories

1

django-tracking

Simple attempt at keeping track of visitors to django-powered web sites
Python
227
star
2

django-secretballot

πŸ—³ Django voting application that allows semi-anonymous voting
Python
209
star
3

django-easy-maps

πŸ—Ί Google Maps with easy!
Python
145
star
4

django-watermark

πŸ’‹ Quick and efficient way to apply watermarks to images in django
Python
75
star
5

wagtail-embedvideos

🎬 Integration of django-embed-video for Wagtail CMS
Python
55
star
6

django-airports

✈️ It's like django-cities, but django-airports
Python
55
star
7

wagtail-metadata-mixin

πŸ” OpenGraph, Twitter Card and Schema.org snippet tags for Wagtail CMS pages
Python
47
star
8

django-birthday

πŸŽ‚ django-birthday is a helper library to work with birthdays in models
Python
24
star
9

monit.conf.d

⏰ Monit configuration files / recipes supporting many programs and processes
23
star
10

django-filters-mixin

django-filter meets django-pagination
Python
19
star
11

django-cached-modelforms

🌟 ModelChoiceField implementation that can accept lists of objects, not just querysets
Python
14
star
12

django-addthis

πŸ‘ A simple integration of the AddThis social sharing widget for Django projects
Python
10
star
13

django-popularity-mixin

🀩 Simple integration between django-cacheback and django-hitcount
Python
9
star
14

django-easy-seo

πŸ” SEO fields for objects of any model registered in admin
Python
9
star
15

django-fineuploader

⬆️ Simple Fine Uploader integration for Django
JavaScript
8
star
16

django-fancybox

🎁 Simple fancybox modal for Django
Python
8
star
17

django-uncharted

πŸ“ŠπŸ“ˆ Simple amCharts integration for Django
Python
8
star
18

django-unitology

πŸ“ Custom model fields to store, retrieve and convert measurements of height, weight and more...
Python
7
star
19

django-simple-currencies

Currency, exchange rate and conversions support for django projects
Python
5
star
20

django-facebox

Simple facebox modal for Django
JavaScript
5
star
21

django-charsleft-widget

πŸ‘» Custom widget that limits the number of characters that can be entered in a textarea field
Python
4
star
22

django-taggit-anywhere

πŸ”– django-taggit with easy!
Python
4
star
23

fluentcms-filer

πŸ—„ django-filer content plugins for django-fluent-contents
Python
3
star
24

fluentcms-forms-builder

πŸ›  django-forms-builder plugin for django-fluent-contents
Python
3
star
25

django-permanent-helpers

πŸ§Ÿβ€β™‚οΈ django admin helper classes for django-permanent models
Python
3
star
26

django-ckeditor-filer

A django-filer based CKEditor filebrowser
JavaScript
2
star
27

fluentcms-suit

🦐 django-fluent-pages meets django-suit
HTML
2
star
28

awesome-fluentcms

A curated list of awesome Fluent CMS add-ons, projects and resources
2
star
29

fluentcms-publishing

django-fluent-pages meets django-model-publisher
Python
2
star
30

django-smileys

Python
1
star
31

vagrant-dev-box

πŸ›  Vagrant configuration for a base box for Django site development
Shell
1
star
32

django-crumbs-mixin

Python
1
star
33

fluentcms-link

πŸ”— Link plugin for django-fluent-contents
Python
1
star
34

django-sitecats-helpers

😹 django admin helper classes for django-sitecats categories
Python
1
star
35

django-clearable-widget

πŸ‘» Custom widget to add a (x) clear button to your input fields
Python
1
star