我正在尝试从amazon s3提供gzip文件.
这是我的settings.py:
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压缩创建* .gz文件,但奇怪的是只有* .css文件作为gzip提供.我可以在aws s3上看到.css文件有Content-Encoding:gzip而* .js没有.这里发生了什么?
最佳答案