5
我想從亞馬遜s3服務gzip文件。 這是我的settings.py:Django壓縮器使用gzip服務javascript
AWS_IS_GZIPPED = True
AWS_PRELOAD_METADATA = True
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_STORAGE_BUCKET_NAME = 'elasticbeanstalk-eu-west-1-2051565523'
STATIC_URL = 'https://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
COMPRESS_OFFLINE = True
COMPRESS_ENABLED = True
COMPRESS_URL = STATIC_URL
COMPRESS_CSS_FILTERS = [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.CSSMinFilter'
]
COMPRESS_JS_FILTERS = [
'compressor.filters.jsmin.JSMinFilter',
]
COMPRESS_STORAGE = 'compressor.storage.GzipCompressorFileStorage'
當我這樣做Django的每一個* .js文件中創建*。廣州文件,*。的CSS壓縮但奇怪的只有* .css文件都擔任gzip的。我可以在aws s3上看到.css文件具有Content-Encoding:gzip和* .js不包含。這裏發生了什麼?
我可以問你爲什麼定義'COMPRESS_STORAGE'兩次? –
@MarcusLind我編輯了這個問題。感謝您的電話 –