我想在S3 AWS上部署我的項目靜態文件,但是當我在終端上收集靜態文件時,出現此錯誤。我聽說,它看起來像你,我想包括我的模板靜態資產,但我已經指定了一個目錄,而不是一個文件......,我不明白這一點:/Django MissingFileError:路徑是一個目錄
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/damian/proj1/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/base.py", line 57, in __call__
static_file = self.find_file(environ['PATH_INFO'])
File "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/django.py", line 75, in find_file
return self.get_static_file(path, url)
File "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/base.py", line 111, in get_static_file
self.add_stat_headers(headers, path, url)
File "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/base.py", line 121, in add_stat_headers
file_stat = stat_regular_file(path)
File "/home/damian/proj1/local/lib/python2.7/site-packages/whitenoise/utils.py", line 30, in stat_regular_file
raise MissingFileError('Path is a directory: {0}'.format(path))
MissingFileError: Path is a directory: /home/damian/proj1/blog/static_in_pro/our_static
[08/Aug/2016 13:14:21] "GET/HTTP/1.1" 500 59
我(不是全部)設置:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static_in_env", "static_root")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static_in_pro", "our_static"),
#'/var/www/static/',
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "static_in_env", "media_root")
CRISPY_TEMPLATE_PACK = 'bootstrap3'
MEDIAFILES_DIRS = (MEDIA_ROOT)
#AWS S3 STATICK FILES
AWS_HEADERS = { # see http://developer.yahoo.com/performance/rules.html#expires
'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT',
'Cache-Control': 'max-age=94608000',
}
AWS_STORAGE_BUCKET_NAME = '###'
AWS_ACCESS_KEY_ID = '###'
AWS_SECRET_ACCESS_KEY = '###'
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
感謝您的幫助,並指出正在進行的工作的正確路徑! 乾杯
它工作:)謝謝 – Damian