Skip to main content

statusboard

Build Status Pypi codecov Documentation Status

Status page application with browser and REST API interface.

Installation

Install the package

pip install django-statusboard

Add the following applications to your Django projects

INSTALLED_APPS += [
    'django.contrib.humanize',
    'django.contrib.staticfiles',
    'rest_framework',
    'statusboard',
]

Update your urlconf:

# myproject/urls.py
urlpatterns += [
    url(r'^statusboard/$', include('statusboard.urls')),
]

Update your database

./manage migrate

Configuration

You can configure the app using the dict STATUSBOARD in settings.py:

from django.contrib.staticfiles.templatetags.staticfiles import static
# for Django >= 3.0: from django.templatetags.static import static

STATUSBOARD = {
    "INCIDENT_DAYS_IN_INDEX": 7,
    "OPEN_INCIDENT_IN_INDEX": True,
    "AUTO_REFRESH_INDEX_SECONDS": 0,
    "FAVICON_DEFAULT": static('statusboard/images/statusboard-icon-default.png'),
    "FAVICON_INDEX_DICT": {
        0: static('statusboard/images/statusboard-icon-operational.png'),
        1: static('statusboard/images/statusboard-icon-performance.png'),
        2: static('statusboard/images/statusboard-icon-partial.png'),
        3: static('statusboard/images/statusboard-icon-major.png'),
    },
}
  • INCIDENT_DAYS_IN_INDEX: number of days to show in index (1 = today).
  • OPEN_INCIDENT_IN_INDEX: show not fixed incidents in index, whether or not the incident is older than INCIDENT_DAYS_IN_INDEX.
  • AUTO_REFRESH_INDEX_SECONDS: auto refresh home page every N seconds (0 = disabled).
  • FAVICON_DEFAULT: default favicon.
  • FAVICON_INDEX_DICT: favicon for index, based on the worst status (default: FAVICON_DEFAULT). The keys (0, 1, 2, 3) are the status values (see SERVICE_STATUSES in statusboard/models.py).

Customize pages

The following blocks are customizable in statusboard/base.html:

  • title: title of the page
  • branding: branding in fixed navbar
  • bootstrap_theme: bootstrap theme
  • header: header of the page
  • userlinks: links in the header
  • footer: footer div
  • style: CSS files
  • script: JavaScript files

To customize the default style, create the file statusboard/base.html that extends the original base template and customize some blocks, e.g.:

{% extends "statusboard/base.html" %}

{% load static %}

{% block title %}
A.C.M.E. statuspage
{% endblock %}

{% block branding %}
<a class="navbar-brand" href="{% url 'statusboard:index' %}"><img src="{% static "/images/logo.png" %}"></a>
{% endblock %}

{% block bootstrap_theme %}
<link rel="stylesheet" href="{% static "/statusboard/css/spacelab-bootstrap.min.css" %}" />
<link rel="stylesheet" href="{% static "/css/mystyle.css" %}" />
{% endblock %}

Example: change branding and title

In Django >= 1.9, the templates can be extended recursively (see https://docs.djangoproject.com/en/1.9/releases/1.9/#templates).

Create a statusboard/base.html in one of your templates dir:

{% extends `statusboard/base.html %}

{% block title %}
ACME, Inc.
{% endblock %}

{% block branding %}
<a class="navbar-brand" href="{% url 'statusboard:index' %}">ACME status</a>
{% endblock %}

Notifications

django-statusboard doesn't provide an out-of-the-box notification system, but it's easy to implement using django signals.

Moreover, django-statusboard tracks the previous status of a service (Service._status).

from django.dispatch import receiver
from django.db.models.signals import post_save
from django.core.mail import mail_admins

from statusboard import Service

@receiver(post_save, sender=Service)
def notify_service_update(sender, instance, **kwargs):
    # Send an email to admins if the service is getting worse, otherwise do nothing.
    if instance.status > instance._status:
        mail_admins("Alert", "Service {} is {}".format(instance.name, instance.get_status_display()))

REST API

django-statusboard comes with a set of REST API to manage its models, based on Django REST Framework ModelViewSet.

Development

Running tests

$ DJANGO_SETTINGS_MODULE=tests.test_settings python manage.py test

Update i18n

$ cd statusboard && django-admin makemessages -l LOCALE

Contact and copyright information

Copyright (C) 2019 Emanuele Di Giacomo emanuele@digiacomo.cc

django-statusboard is licensed under GPLv2+.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-statusboard-0.11.0.tar.gz (435.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_statusboard-0.11.0-py3-none-any.whl (468.9 kB view details)

Uploaded Python 3

File details

Details for the file django-statusboard-0.11.0.tar.gz.

File metadata

  • Download URL: django-statusboard-0.11.0.tar.gz
  • Upload date:
  • Size: 435.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.10

File hashes

Hashes for django-statusboard-0.11.0.tar.gz
Algorithm Hash digest
SHA256 25f84332c737da9fc800face29ea992c6925624fa0c70c0e38ccab067ff9a318
MD5 755caddacdd921d7051e8bfd1034d8af
BLAKE2b-256 f0c34c7f80502704bdde652a32332d62e89d89f42b2987840299ecf1c82629fd

See more details on using hashes here.

File details

Details for the file django_statusboard-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: django_statusboard-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 468.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.10

File hashes

Hashes for django_statusboard-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c7d4940f54d4f9d7f67af163295b9084bdf88c2c000403204e9bff3ee982b1a
MD5 4e025f4495f73aed32ce77f1bb84d995
BLAKE2b-256 30f367045c4bcc3c2423bfd6aae236f23e9739f8eb3b485d0d3d34d57ff677ad

See more details on using hashes here.

Release history Release notifications | RSS feed

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

This release

0.11.0 This release

2 files

0.10.0

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

1 file

0.9.0

1 file

0.8.1

1 file

0.8.0

1 file

0.7.1

1 file

0.7.0

1 file

0.6.1

1 file

0.5.6

1 file

0.5.5

1 file

0.5.4

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.1

1 file

0.4

1 file

0.3.31

1 file

0.3.30

1 file

0.3.29

1 file

0.3.28

1 file

0.3.26

1 file

0.3.25

1 file

0.3.24

1 file

0.3.23

1 file

0.3.22

1 file

0.3.21

1 file

0.3.20

1 file

0.3.18

1 file

0.3.17

1 file

0.3.16

1 file

0.3.15

1 file

0.3.14

1 file

0.3.13

1 file

0.3.12

1 file

0.3.11

1 file

0.3.10

1 file

0.3.9

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page