[PATCH] Define and use STATIC_URL and STATIC_ROOT on Django 1.4+
Khem Raj
raj.khem at gmail.com
Wed Nov 6 15:52:00 EST 2013
ADMIN_MEDIA_PREFIX is deprecated
Signed-off-by: Khem Raj <raj.khem at 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 --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>
--
1.7.9.5
More information about the Patchwork
mailing list