【发布时间】:2014-10-07 16:07:34
【问题描述】:
请您帮忙运行 collect static to amazon s3 吗?
这是我的配置文件:
05_collect_admin_static:
command: "python manage.py collectstatic --noinput"
leader_only: true
在设置文件中 我在用 django-storages==1.1.8 和 boto==2.32.1
INSTALLED_APPS += ('storages',)
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_KEY']
AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME']
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
STATIC_URL = S3_URL
这是我的日志:
/var/log/cfn-init.log
execute_from_command_line(sys.argv)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 173, in handle_noargs
collected = self.collect()
File "/opt/python/run/venv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 112, in collect
handler(path, prefixed_path, storage)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 317, in copy_file
self.storage.save(prefixed_path, source_file)
File "/opt/python/run/venv/lib/python2.7/site-packages/django/core/files/storage.py", line 49, in save
name = self._save(name, content)
File "/opt/python/run/venv/lib/python2.7/site-packages/storages/backends/s3boto.py", line 392, in _save
self._save_content(key, content, headers=headers)
File "/opt/python/run/venv/lib/python2.7/site-packages/storages/backends/s3boto.py", line 403, in _save_content
rewind=True, **kwargs)
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/s3/key.py", line 1286, in set_contents_from_file
chunked_transfer=chunked_transfer, size=size)
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/s3/key.py", line 746, in send_file
chunked_transfer=chunked_transfer, size=size)
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/s3/key.py", line 944, in _send_file_internal
query_args=query_args
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/s3/connection.py", line 664, in make_request
retry_handler=retry_handler
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/connection.py", line 1053, in make_request
retry_handler=retry_handler)
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/connection.py", line 923, in _mexe
request.body, request.headers)
File "/opt/python/run/venv/lib/python2.7/site-packages/boto/s3/key.py", line 840, in sender
http_conn.send(chunk)
File "/usr/lib64/python2.7/httplib.py", line 805, in send
self.sock.sendall(data)
File "/usr/lib64/python2.7/ssl.py", line 229, in sendall
v = self.send(data[count:])
File "/usr/lib64/python2.7/ssl.py", line 198, in send
v = self._sslobj.write(data)
socket.error: [Errno 104] Connection reset by peer
谢谢。它与权限问题有关吗?我正在使用 aws 弹性豆茎。再次感谢。
【问题讨论】:
-
仅供参考,我已经阅读了很多教程,但仍然无法弄清楚出了什么问题。非常感谢你的帮助。 grigory.ca/2012/09/…blog.doismellburning.co.uk/2012/07/14/…dontpanic.ghost.io/django-s3-configuration
标签: django amazon-web-services amazon-s3 amazon-elastic-beanstalk