statusboard
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.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 thanINCIDENT_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 (seeSERVICE_STATUSESinstatusboard/models.py).
Internationalization and localization
django-statusboard supports the following languages:
- English
- Italian
Customize pages
The following blocks are customizable in statusboard/base.html:
title: title of the pagebranding: branding in fixed navbarbootstrap_theme: bootstrap themeheader: header of the pageuserlinks: links in the headerfooter: footer divstyle:CSSfilesscript: 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
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 or you can use django-statusboard-notify that provides some builtin notifications (e.g. email, Telegram).
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:
/api/v0.1/servicegroup//api/v0.1/service//api/v0.1/incident//api/v0.1/incidentupdate//api/v0.1/maintenance/
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-2023 Emanuele Di Giacomo emanuele@digiacomo.cc
django-statusboard is licensed under GPLv2+.
Metadata
Release files for django-statusboard 0.15.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_statusboard-0.15.1.tar.gz | 495.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_statusboard-0.15.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.0 MB
Release files / django_statusboard-0.15.1.tar.gz
| Download URL | django_statusboard-0.15.1.tar.gz |
|---|---|
| Size | 495.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3616b400732279534a55ea58ef41ac1641b914489aa4107e3fecf8562e383c47
|
|
BLAKE2b-256 checksum How to use checksums |
bb4ed3a8919a7638ff01a576f8d5f8b0762773ddec8c674691ea4333f850bdd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / django_statusboard-0.15.1-py3-none-any.whl
| Download URL | django_statusboard-0.15.1-py3-none-any.whl |
|---|---|
| Size | 520.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c59dd240c802ac0b7df37113ec9a73619e7c6bcf4907cb823cfeffcc4d75e26
|
|
BLAKE2b-256 checksum How to use checksums |
74e4c18f663819b41ec31bedcd5f2ccf27111eb2a98f6971e327dc76d410a158
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|