Replace admin/base_site.html with this;
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}
{% block branding %}
Django admin on {{request.META.SERVER_NAME}}, using {{request.META.DJANGO_SETTINGS_MODULE}}
{% endblock %}
{% block nav-global %}Database being used:{{request.META.DATABASE_NAME}} {% 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)