我已经在 Django 1.6 中成功使用django-compressor
并django-storages
管理了我的静态文件的压缩和部署。我现在正在尝试使用 AWS CloudFront 来提供我的静态文件。
我按照这里的说明进行操作,default_storage.exists 非常慢并且经常超时,我的settings.py
文件如下所示:
COMPRESS_ENABLED = True
STATIC_ROOT = os.path.join(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__))), 'static')
COMPRESS_ROOT = STATIC_ROOT
COMPRESS_OFFLINE = True
COMPRESS_URL = "https://compressor-test.s3.amazonaws.com/"
STATIC_URL = COMPRESS_URL
COMPRESS_STORAGE = 'mysite.storage.CachedS3BotoStorage'
STATICFILES_STORAGE = COMPRESS_STORAGE
AWS_STORAGE_BUCKET_NAME = 'compressor-test'
AWS_S3_CUSTOM_DOMAIN = '1234567.cloudfront.net'
但我收到以下错误:
Exception Type: UncompressableFileError
Exception Value:
'https://1234567.cloudfront.net/bootstrap/css/bootstrap.min.css' isn't accessible via COMPRESS_URL ('https://compressor-test.s3.amazonaws.com/') and can't be compressed
我是否需要将 COMPRESS_URL 指向 CloudFront?