diff mbox

Define and use STATIC_URL and STATIC_ROOT on Django 1.4+

Message ID 1383713520-8293-1-git-send-email-raj.khem@gmail.com
State Superseded
Headers show

Commit Message

Khem Raj Nov. 6, 2013, 4:52 a.m. UTC
ADMIN_MEDIA_PREFIX is deprecated

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 apps/settings.py                      |   11 ++++++-----
 lib/apache2/patchwork.fastcgi.conf    |    2 +-
 lib/apache2/patchwork.mod_python.conf |    2 +-
 lib/apache2/patchwork.wsgi.conf       |    4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/apps/settings.py b/apps/settings.py
index 43a37d8..8d996c9 100644
--- a/apps/settings.py
+++ b/apps/settings.py
@@ -41,8 +41,9 @@  MEDIA_URL = ''
 
 # 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/'
+# Corresponds to alias name in webserver (e.g. apache) config file.
+# Examples: "http://foo.com/static/", "/static/".
+STATIC_URL = '/static/'
 
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '00000000000000000000000000000000000000000000000000'
@@ -77,10 +78,10 @@  TEMPLATE_DIRS = (
     # Don't forget to use absolute paths, not relative paths.
     os.path.join(ROOT_DIR, 'templates')
 )
-# Absolute path to the directory that holds media.
+# Absolute path to the directory that holds admin static media.
 # Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = os.path.join(
-    ROOT_DIR, 'lib', 'python', 'django', 'contrib', 'admin', 'media')
+STATIC_ROOT = os.path.join(
+    ROOT_DIR, 'lib', 'python', 'django', 'contrib', 'admin', 'static')
 
 TEMPLATE_CONTEXT_PROCESSORS = (
     "django.contrib.auth.context_processors.auth",
diff --git a/lib/apache2/patchwork.fastcgi.conf b/lib/apache2/patchwork.fastcgi.conf
index a739164..5547927 100644
--- a/lib/apache2/patchwork.fastcgi.conf
+++ b/lib/apache2/patchwork.fastcgi.conf
@@ -2,7 +2,7 @@  NameVirtualHost patchwork.example.com:80
 <VirtualHost patchwork.example.com:80>
 	DocumentRoot /srv/patchwork/htdocs/
 
-	Alias /media/ /srv/patchwork/lib/python/django/contrib/admin/media/
+	Alias /static/ /srv/patchwork/lib/python/django/contrib/admin/static/
 
 	FastCGIExternalServer /srv/patchwork/htdocs/patchwork.fcgi -socket /srv/patchwork/var/fcgi.sock -pass-header Authorization
 
diff --git a/lib/apache2/patchwork.mod_python.conf b/lib/apache2/patchwork.mod_python.conf
index 6dbb09b..f6d1ef0 100644
--- a/lib/apache2/patchwork.mod_python.conf
+++ b/lib/apache2/patchwork.mod_python.conf
@@ -2,7 +2,7 @@  NameVirtualHost patchwork.example.com:80
 <VirtualHost patchwork.example.com:80>
 	DocumentRoot /srv/patchwork/htdocs/
 
-	Alias /media/ /srv/patchwork/lib/python/django/contrib/admin/media/
+	Alias /static/ /srv/patchwork/lib/python/django/contrib/admin/static/
 
 	<Location "/">
 	    SetHandler python-program
diff --git a/lib/apache2/patchwork.wsgi.conf b/lib/apache2/patchwork.wsgi.conf
index 3756e5a..e682d74 100644
--- a/lib/apache2/patchwork.wsgi.conf
+++ b/lib/apache2/patchwork.wsgi.conf
@@ -8,9 +8,9 @@ 
                 Allow from all
         </Directory>
 
-        Alias /media/ "/usr/share/python-support/python-django/django/contrib/admin/media/"
+        Alias /static/ "/usr/share/python-support/python-django/django/contrib/admin/static/"
 
-        <Directory "/usr/share/python-support/python-django/django/contrib/admin/media/">
+        <Directory "/usr/share/python-support/python-django/django/contrib/admin/static/">
                 Order allow,deny
                 Allow from all
         </Directory>