Esempio n. 1
0
def maintenance_view(request):
    # We don't want users to access maintenance site
    # when maintenance is disabled.
    if not is_maintenance_mode_enabled():
        return HttpResponseRedirect('/')
    maintenance_info = get_maintenance_mode()
    return render(request, 'maintenance.html',
                  {'message': maintenance_info['message']})
Esempio n. 2
0
def maintenance_view(request):
    # We don't want users to access maintenance site
    # when maintenance is disabled.
    if not is_maintenance_mode_enabled():
        return HttpResponseRedirect('/')
    maintenance_info = get_maintenance_mode()
    return render(request, 'maintenance.html',
                  {'message': maintenance_info['message']})
Esempio n. 3
0
    def process_request(self, request):
        if not is_maintenance_mode_enabled():
            return None

        # We want to allow admin access the site
        if hasattr(request, 'user'):
            if request.user.is_superuser:
                return None

        # If admin logged in as another user, the information who
        # the real user is is stored in real_user
        if hasattr(request, 'real_user'):
            if request.real_user.is_superuser:
                return None

        # Maybe we want to allow user access some links
        for url in settings.MAINTENANCE_MODE_IGNORE_URLS:
            if re.search(url, request.path_info):
                return None

        # We redirect users to the url specified in settings.
        return HttpResponseRedirect(settings.MAINTENANCE_MODE_REDIRECT_URL)
Esempio n. 4
0
    def _process_request(self, request):
        if not is_maintenance_mode_enabled():
            return None

        # We want to allow admin access the site
        if hasattr(request, 'user'):
            if request.user.is_superuser:
                return None

        # If admin logged in as another user, the information who
        # the real user is is stored in real_user
        if hasattr(request, 'real_user'):
            if request.real_user.is_superuser:
                return None

        # Maybe we want to allow user access some links
        for url in settings.MAINTENANCE_MODE_IGNORE_URLS:
            if re.search(url, request.path_info):
                return None

        # We redirect users to the url specified in settings.
        return HttpResponseRedirect(settings.MAINTENANCE_MODE_REDIRECT_URL)
Esempio n. 5
0
def is_maintenance_enabled():
    return is_maintenance_mode_enabled()
def is_maintenance_enabled():
    return is_maintenance_mode_enabled()