diff --git a/openshift/templates/openshift/index.html b/openshift/templates/openshift/index.html
index 3bba971..75e58c3 100644
--- a/openshift/templates/openshift/index.html
+++ b/openshift/templates/openshift/index.html
@@ -51,6 +51,7 @@
Server hostname: {{ hostname }}
+ Database server: {{ database_info }}
Page views: {{ count }}
diff --git a/openshift/views.py b/openshift/views.py
index 679bbe9..120c9f6 100644
--- a/openshift/views.py
+++ b/openshift/views.py
@@ -1,14 +1,31 @@
import os
from django.shortcuts import render
+from django.conf import settings
from .models import PageView
# Create your views here.
+
+def _database_info():
+ db_settings = settings.DATABASES['default']
+ if 'postgres' in db_settings['ENGINE']:
+ engine = 'PostgreSQL'
+ info = '{HOST}:{PORT}/{NAME}'.format(**db_settings)
+ else:
+ engine = 'SQLite'
+ info = '{NAME}'.format(**db_settings)
+ return '{} ({})'.format(engine, info)
+
+database_info = _database_info()
+
+
def index(request):
hostname = os.getenv('HOSTNAME', 'unknown')
PageView.objects.create(hostname=hostname)
+
return render(request, 'openshift/index.html', {
'hostname': hostname,
+ 'database_info': database_info,
'count': PageView.objects.count()
})