1

私は、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 に向ける必要がありますか?

4

2 に答える 2

1

COMPRESS_URL を cloudfront に向けてみてください。うまくいくはずです

于 2015-04-27T14:36:52.220 に答える
0

静的ファイルを S3 に書き込み、Cloudfront から読み取るには、次を使用します。

AWS_S3_CUSTOM_DOMAIN = 'yourdistribution.cloudfront.net'

GitHub の関連する django-compressor の問題

于 2017-01-12T09:31:27.100 に答える