Commit fa4e234b by Max Klymyshyn

added two new settings - COMPRESS_ROOT and COMPRESS_URL which point by default…

added two new settings - COMPRESS_ROOT and COMPRESS_URL which point by default to MEDIA_ROOT and MEDIA_URL respectively. That settings make ability to use both django 1.3 django.contrib.staticfiles and django-compress without incompatible issues
parent 6f400b9f
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.conf import settings from django.conf import settings
COMPRESS_ROOT = getattr(settings, 'COMPRESS_ROOT', settings.MEDIA_ROOT)
COMPRESS_URL = getattr(settings, 'COMPRESS_URL', settings.MEDIA_URL)
COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG) COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG)
COMPRESS_AUTO = getattr(settings, 'COMPRESS_AUTO', True) COMPRESS_AUTO = getattr(settings, 'COMPRESS_AUTO', True)
COMPRESS_VERSION = getattr(settings, 'COMPRESS_VERSION', False) COMPRESS_VERSION = getattr(settings, 'COMPRESS_VERSION', False)
......
...@@ -56,14 +56,14 @@ def needs_update(output_file, source_files, verbosity=0): ...@@ -56,14 +56,14 @@ def needs_update(output_file, source_files, verbosity=0):
def media_root(filename): def media_root(filename):
""" """
Return the full path to ``filename``. ``filename`` is a relative path name in MEDIA_ROOT Return the full path to ``filename``. ``filename`` is a relative path name in COMPRESS_ROOT
""" """
return os.path.join(django_settings.MEDIA_ROOT, filename) return os.path.join(settings.COMPRESS_ROOT, filename)
def media_url(url, prefix=None): def media_url(url, prefix=None):
if prefix: if prefix:
return prefix + urlquote(url) return prefix + urlquote(url)
return django_settings.MEDIA_URL + urlquote(url) return settings.COMPRESS_URL + urlquote(url)
def concat(filenames, separator=''): def concat(filenames, separator=''):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment