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
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
Example: change branding and title
Django 1.8
Copy statusboard/templates/statusboard/base.html in one of your templates dir and edit the file.
Django >= 1.9
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-statusboard-0.7.0.tar.gz.
File metadata
- Download URL: django-statusboard-0.7.0.tar.gz
- Upload date:
- Size: 208.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbc21402989b3b2e06e67939fbf94c485adcc4416c6b03a8c626eb4f1af3aa9f
|
|
| MD5 |
7f78a23727f2d775d3ee4a494ae98d77
|
|
| BLAKE2b-256 |
0983a48ec3f506c19a2e6478029dcfe0fb21a6ed1dec2f59ee4de17f24cf9a7d
|