Replace admin/base_site.html with this;

{% extends "admin/base.html" %}
{% load i18n %}

{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}

{% block branding %}
<h1 id="site-name">Django admin on {{request.META.SERVER_NAME}}, using {{request.META.DJANGO_SETTINGS_MODULE}}</h1>
<h2 id="site-url"><a href="/admin">root</a>&nbsp;<a href="/admin/doc/">Documentation</a></h2>
{% endblock %}
{% block nav-global %}Database being used:<span style="color:red;">{{request.META.DATABASE_NAME}}</span>&nbsp;{% endblock %}


Example for a WSGI server

import os, sys
import settings
sys.path.append('/www/project_location')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['DATABASE_NAME'] = settings.DATABASE_NAME

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Example for manage.py

#!/usr/bin/env python
import os
from django.core.management import execute_manager
try:
    import settings # Assumed to be in the same directory.
    os.environ['DATABASE_NAME'] = settings.DATABASE_NAME
except ImportError:
    import sys
    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It ap
pears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module
.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
    sys.exit(1)

if __name__ == "__main__":
    execute_manager(settings)
