我正在尝试使用 S3 作为静态文件的生产存储,但是每当我收集静态文件时,我看到它们被上传到 S3 存储桶,压缩版本没有被创建/上传(在 中提到的那些output_filename
)。
这是我的相关位:
PIPELINE_YUI_BINARY = '/usr/bin/yui-compressor'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
PIPELINE_JS = {
'main': {
'source_filenames': (
...
),
'output_filename': 'build/app.min.js',
}
}
PIPELINE_CSS = {
'main': {
'source_filenames': (
...
),
'output_filename': 'build/app.min.css',
'variant': 'datauri',
}
}
# Amazon S3 static storage
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME']
AWS_QUERYSTRING_AUTH = False
AWS_IS_GZIPPED = True
AWS_HEADERS = {
'Cache-Control': 'max-age=86400',
}
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# these next two aren't used, but staticfiles will complain without them
STATIC_URL = "https://%s.s3.amazonaws.com/" % os.environ['AWS_STORAGE_BUCKET_NAME']
STATIC_ROOT = ''
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
没有build
创建目录。我不认为压缩机甚至运行。控制台没有任何抱怨。我究竟做错了什么?