我正在使用Amazon S3存儲區來存儲我的靜態文件。 我在Django壓縮器應用程序壓縮所有的靜態文件。 Django的給我的錯誤:Django UncompressableFileError
'home_page/css/bootstrap.min.css' isn't accessible via COMPRESS_URL (' https://alphagravel.s3.amazonaws.com/static/ ') and can't be compressed
同樣,你可以點擊這裏:http://52.5.32.9/
但是:URL - 'https://alphagravel.s3.amazonaws.com/static/home_page/css/bootstrap.min.css' 是受
這裏是我的setting.py快照 「」」
INSTALLED_APPS = (
...
'storages',
'compressor',
'...
)
AWS_ACCESS_KEY_ID = '****'
AWS_SECRET_ACCESS_KEY = '***********'
AWS_QUERYSTRING_AUTH = False
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_STORAGE_BUCKET_NAME = 'alphagravel'
AWS_PRELOAD_METADATA = True
STATIC_URL = 'https://alphagravel.s3.amazonaws.com/static/'
ADMIN_MEDIA_PREFIX = 'https://s3-us-west-2.amazonaws.com/alphagravel/admin/'
COMPRESS_ROOT = STATIC_URL
COMPRESS_URL = STATIC_URL
COMPRESS_STORAGE = STATICFILES_STORAGE
COMPRESS_ENABLED = True
COMPRESS_OFFLINE_MANIFEST = "manifest.json" # Is created in CACHE directory
COMPRESS_PARSER = 'compressor.parser.HtmlParser'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
誰能告訴我爲什麼壓縮機的URL無法找到靜態文件進行壓縮。以及如何解決錯誤。
此外,在命令行:在執行命令python manage.py compress --force
我獲得以下錯誤:
CommandError: An error occured during rendering /var/www/alphagravel/dashboard/templates/header.html: 'css/bootstrap.min.css' could not be found in the COMPRESS_ROOT '/var/www/alphagravel/https:/alphagravel.s3.amazonaws.com/static' or with staticfiles.
什麼是您的ALLOWED_HOSTS設置? –