PageRenderTime 55ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/rooibos/contrib/compressor/conf/settings.py

https://github.com/knabar/fynbos
Python | 64 lines | 59 code | 5 blank | 0 comment | 1 complexity | 55e4eaecdacaa1a44d24b7e52ac08678 MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
  1. from django.core.exceptions import ImproperlyConfigured
  2. from django.conf import settings
  3. MEDIA_URL = getattr(settings, 'COMPRESS_URL', settings.MEDIA_URL)
  4. if not MEDIA_URL.endswith('/'):
  5. raise ImproperlyConfigured(
  6. 'The MEDIA_URL and COMPRESS_URL settings must have a trailing slash.')
  7. MEDIA_ROOT = getattr(settings, 'COMPRESS_ROOT', settings.MEDIA_ROOT)
  8. OUTPUT_DIR = getattr(settings, 'COMPRESS_OUTPUT_DIR', 'CACHE')
  9. STORAGE = getattr(settings, 'COMPRESS_STORAGE', 'compressor.storage.CompressorFileStorage')
  10. COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG)
  11. COMPRESS_CSS_FILTERS = getattr(settings, 'COMPRESS_CSS_FILTERS', ['compressor.filters.css_default.CssAbsoluteFilter'])
  12. COMPRESS_JS_FILTERS = getattr(settings, 'COMPRESS_JS_FILTERS', ['compressor.filters.jsmin.JSMinFilter'])
  13. COMPRESS_LESSC_BINARY = LESSC_BINARY = getattr(settings, 'COMPRESS_LESSC_BINARY', 'lessc')
  14. CLOSURE_COMPILER_BINARY = getattr(settings, 'COMPRESS_CLOSURE_COMPILER_BINARY', 'java -jar compiler.jar')
  15. CLOSURE_COMPILER_ARGUMENTS = getattr(settings, 'COMPRESS_CLOSURE_COMPILER_ARGUMENTS', '')
  16. CSSTIDY_BINARY = getattr(settings, 'CSSTIDY_BINARY',
  17. getattr(settings, 'COMPRESS_CSSTIDY_BINARY', 'csstidy'))
  18. CSSTIDY_ARGUMENTS = getattr(settings, 'CSSTIDY_ARGUMENTS',
  19. getattr(settings, 'COMPRESS_CSSTIDY_ARGUMENTS', '--template=highest'))
  20. YUI_BINARY = getattr(settings, 'COMPRESS_YUI_BINARY', 'java -jar yuicompressor.jar')
  21. YUI_CSS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_CSS_ARGUMENTS', '')
  22. YUI_JS_ARGUMENTS = getattr(settings, 'COMPRESS_YUI_JS_ARGUMENTS', '')
  23. if COMPRESS_CSS_FILTERS is None:
  24. COMPRESS_CSS_FILTERS = []
  25. if COMPRESS_JS_FILTERS is None:
  26. COMPRESS_JS_FILTERS = []
  27. DATA_URI_MIN_SIZE = getattr(settings, 'COMPRESS_DATA_URI_MIN_SIZE', 1024)
  28. # rebuilds the cache every 30 days if nothing has changed.
  29. REBUILD_TIMEOUT = getattr(settings, 'COMPRESS_REBUILD_TIMEOUT', 2592000) # 30 days
  30. # the upper bound on how long any compression should take to be generated
  31. # (used against dog piling, should be a lot smaller than REBUILD_TIMEOUT
  32. MINT_DELAY = getattr(settings, 'COMPRESS_MINT_DELAY', 30) # 30 seconds
  33. # check for file changes only after a delay (in seconds, disabled by default)
  34. MTIME_DELAY = getattr(settings, 'COMPRESS_MTIME_DELAY', None)
  35. # the backend to use when parsing the JavaScript or Stylesheet files
  36. PARSER = getattr(settings, 'COMPRESS_PARSER', 'compressor.parser.BeautifulSoupParser')
  37. # Allows changing verbosity from the settings.
  38. VERBOSE = getattr(settings, "COMPRESS_VERBOSE", False)
  39. # the cache backend to use
  40. CACHE_BACKEND = getattr(settings, 'COMPRESS_CACHE_BACKEND', None)
  41. if CACHE_BACKEND is None:
  42. # If we are on Django 1.3 AND using the new CACHES setting...
  43. if getattr(settings, "CACHES", None):
  44. CACHE_BACKEND = "default"
  45. else:
  46. # fallback for people still using the old CACHE_BACKEND setting
  47. CACHE_BACKEND = settings.CACHE_BACKEND