summaryrefslogtreecommitdiffstats
path: root/settings.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-12-05 23:06:10 -0600
committerDan McGee <dan@archlinux.org>2011-12-05 23:06:10 -0600
commit943ef2e8e436a32ce5dc956c4d855866cd644cc1 (patch)
tree870f68873a61bcceff00e27b692abaef7542c991 /settings.py
parent1c23308299f33e5b429899463eb207f07ad51403 (diff)
downloadarchweb-943ef2e8e436a32ce5dc956c4d855866cd644cc1.tar.gz
archweb-943ef2e8e436a32ce5dc956c4d855866cd644cc1.zip
Convert to and enable staticfiles contrib application
This moves our site static files into the sitestatic directory if they are shared resources, and also moves a handful of things (such as the artwork logos) into application-specific static/ directories. This allows the staticfiles contrib app to work after a few settings tweaks, a run of collectstatic, and massaging the hardcoded '/media/' prefix out of our templates. Django 1.4 is going to make this a lot easier to move things to a CDN and provides better template tags; for now this is setting the stage before we can move to that. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'settings.py')
-rw-r--r--settings.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/settings.py b/settings.py
index b22b4293..a898381a 100644
--- a/settings.py
+++ b/settings.py
@@ -34,11 +34,6 @@ SITE_ID = 1
DATE_FORMAT = 'Y-m-d'
DATETIME_FORMAT = 'Y-m-d H:i'
-# 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/admin_media/'
-
# Login URL configuration
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
@@ -52,6 +47,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
+ 'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages',
'main.context_processors.secure',
)
@@ -84,6 +80,17 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'urls'
+# URL to serve static files
+STATIC_URL = '/static/'
+
+# Location to collect static files
+STATIC_ROOT = os.path.join(DEPLOY_PATH, 'collected_static')
+
+# Look for more static files in these locations
+STATICFILES_DIRS = (
+ os.path.join(DEPLOY_PATH, 'sitestatic'),
+)
+
# Configure where messages should reside
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
@@ -100,14 +107,16 @@ INSTALLED_APPS = (
'django.contrib.sitemaps',
'django.contrib.admin',
'django.contrib.markup',
- 'main', # contains shared models and libs
+ 'django.contrib.staticfiles',
+ 'south',
+
+ 'main',
'mirrors',
'news',
'packages',
'todolists',
'devel',
'public',
- 'south', # database migration support
'releng',
'visualize',
)