diff --git a/django/conf/admin_templates/base.html b/django/conf/admin_templates/base.html
index a977d202e2..dc0b18faef 100644
--- a/django/conf/admin_templates/base.html
+++ b/django/conf/admin_templates/base.html
@@ -3,7 +3,7 @@
{% block title %}{% endblock %}
-
+
{% block extrastyle %}{% endblock %}
{% block extrahead %}{% endblock %}
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index ebf6a46ceb..1c5c589ed5 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -54,6 +54,11 @@ AUTH_SESSION_COOKIE = 'rizzo'
# List of locations of the template source files, in search order.
TEMPLATE_DIRS = ()
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/media/'
+
# Default e-mail address to use for various automated correspondence from
# the site managers.
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
diff --git a/django/conf/project_template/settings/admin.py b/django/conf/project_template/settings/admin.py
index 0cd2cb6c55..405a5ebad8 100644
--- a/django/conf/project_template/settings/admin.py
+++ b/django/conf/project_template/settings/admin.py
@@ -10,3 +10,8 @@ MIDDLEWARE_CLASSES = (
'django.middleware.admin.AdminUserRequired',
'django.middleware.common.CommonMiddleware',
)
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/media/'
diff --git a/django/templatetags/adminmedia.py b/django/templatetags/adminmedia.py
new file mode 100644
index 0000000000..a3f2dd9ca9
--- /dev/null
+++ b/django/templatetags/adminmedia.py
@@ -0,0 +1,18 @@
+from django.core import template
+
+class AdminMediaPrefixNode(template.Node):
+ def render(self, context):
+ try:
+ from django.conf.settings import ADMIN_MEDIA_PREFIX
+ except ImportError:
+ return ''
+ return ADMIN_MEDIA_PREFIX
+
+def admin_media_prefix(parser, token):
+ """
+ {% admin_media_prefix %}
+ """
+ bits = token.contents.split()
+ return AdminMediaPrefixNode()
+
+template.register_tag('admin_media_prefix', admin_media_prefix)
diff --git a/django/views/admin/main.py b/django/views/admin/main.py
index 2138f07066..39ed83f902 100644
--- a/django/views/admin/main.py
+++ b/django/views/admin/main.py
@@ -7,6 +7,7 @@ from django.models.auth import log
from django.utils.html import strip_tags
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
from django.utils.text import get_text_list
+from django.conf.settings import ADMIN_MEDIA_PREFIX
import operator
# Text to display within changelist table cells if the value is blank.
@@ -276,7 +277,7 @@ def change_list(request, app_label, module_name):
# Search form.
if lookup_opts.admin.search_fields:
raw_template.append('