Keep Sabbath

Sabbath Redirects, Django-Powered Websites.

A free & open-source Django app for easy Sabbath and Holy-day redirects.
Get Started

What Is Keep-Sabbath?

Django Keep-Sabbath is a free & open source Django app to automatically redirect visitors coming to a website when it is the Sabbath or a Holy day.

Keep-Sabbath is for webmasters with e-commerce shops, blogs, etc. who would like to keep the Biblical 7th-day Sabbath and other Holy days of the Bible Holy. The django app allows you to easily setup a system for a Django-powered website that will automatically redirect visitors to a single page (explaining about the Sabbath, redirect, etc.) if it is the Sabbath day or another Holy day.

The app uses internal, offline calculations (via the SolarTime module) and the current date/time of the server to figure out if it is the Sabbath day (thus, if the user should be redirected), so you do not have to do it manually. It is optimized for performance and speed.

There is also an option to manually override it as well, which is useful for other Biblical Holy days.

The timing is based on the understanding that the Sabbath day starts on 6th day ("friday") evening and ends on 7th day ("saturday") evening, according to the Bible.

"If thou turn away thy foot from the sabbath, [from] doing thy pleasure on My holy day; and call the sabbath a delight, the holy of Yahweh, honourable; and shalt honour him, not doing thine own ways, nor finding thine own pleasure, nor speaking [thine own] words:
Then shalt thou delight thyself in Yahweh; and I will cause thee to ride upon the high places of the earth, and feed thee with the heritage of Jacob thy father: for the mouth of Yahweh hath spoken [it]."

-Isaiah 58:13-14

Keep-Sabbath Features

Simple setup
2 ways to use it
Support for overriding
Automatically redirects
Supports Django 2.2, 3.0 +
Free & open source

Get Started Using Keep-Sabbath

1. Install package

Django Keep-Sabbath is best installed via PyPI.

To install the latest version, run:
pip install keep-sabbath

or install from Github source:
pip install git+git://

Make sure to have Django version 2.2, 3.0+ installed on your system.

To install the latest version, run:
pip install django --upgrade

2. Setup app and

Add keep_sabbath to INSTALLED_APPS in for your project:


Include keep_sabbath.urls inside the urlpatterns list in for your project:

    from django.contrib import admin
    from django.urls import path, include
    urlpatterns = [
        path('sabbath-redirect/', include('keep_sabbath.urls')),

3. Configure settings

Add SABBATH_REDIRECT_TEMPLATE in for your project and set it to the name of the template you want visitors to be redirected to when it is the Sabbath or a Holy Day:

    SABBATH_REDIRECT_TEMPLATE = "sabbath/redirect.html"

Don't forget to make the HTML template and/or directory you specify for the SABBATH_REDIRECT_TEMPLATE setting.

Add SABBATH_MANUAL_OVERRIDE in for your project and set it to False if you do not want to override or True if you do (e.g: on a Holy day you will want to set this to True):

    SABBATH_MANUAL_OVERRIDE = False # or True if you want to override

Due to the fact that sunrise and sunset times depend on your location, you will need to set your location. Look up the latitude and longitude of your area and add the following settings.

Add SABBATH_COORDS_LATITUDE in for your project and set it to the latitude of your area:

    SABBATH_COORDS_LATITUDE = yourarealatitudeasafloat

Add SABBATH_COORDS_LONGITUDE in for your project and set it to the longitude of your area:

    SABBATH_COORDS_LONGITUDE = yourarealongitudeasafloat

Add SABBATH_LOCAL_TIMEZONE in for your project and set it to the timezone of your area:

    SABBATH_LOCAL_TIMEZONE = 'US/Central' # Set this to a pytz acceptable timezone (see below)

Valid timezone values can be seen here.

4. Use in

There are two ways to use Django Keep-Sabbath in your file:

1. Use the @redirect_if_sabbath decorator in your file:

    from keep_sabbath import redirect_if_sabbath
    # Method 1 (easier, but less control)
    def my_firstview(request):

2. Use the is_sabbath function in your file:

    from keep_sabbath import is_sabbath
    # Method 2 (you figure out the view logic, but more control)
    def my_secondview(request):
        if is_sabbath() == True:

Both methods can be used interchangably and in the same file and project.

Want To Help Develop Keep-Sabbath?

Keep-Sabbath is a free & open source Django app hosted on Github and PyPI. Help improving this package to meet the project goals is always welcome. :)