gpt4 book ai didi

python - Django collectstatic boot broken pipe on large file upload

转载 作者:太空狗 更新时间:2023-10-29 20:10:51 27 4
gpt4 key购买 nike

我正在尝试使用 collectstatic 将静态文件上传到我的 S3 存储桶,但我遇到了 700k javascript 文件的管道损坏错误,这就是错误

Copying '/Users/wedonia/work/asociados/server/asociados/apps/panel/static/panel/js/js.min.js'
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 173, in handle_noargs
collected = self.collect()
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 112, in collect
handler(path, prefixed_path, storage)
File "/Users/wedonia/work/asociados/server/envs/asociados/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 "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/django/core/files/storage.py", line 49, in save
name = self._save(name, content)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/storages/backends/s3boto.py", line 392, in _save
self._save_content(key, content, headers=headers)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/storages/backends/s3boto.py", line 403, in _save_content
rewind=True, **kwargs)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/s3/key.py", line 1291, in set_contents_from_file
chunked_transfer=chunked_transfer, size=size)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/s3/key.py", line 748, in send_file
chunked_transfer=chunked_transfer, size=size)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/s3/key.py", line 949, in _send_file_internal
query_args=query_args
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/s3/connection.py", line 664, in make_request
retry_handler=retry_handler
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/connection.py", line 1068, in make_request
retry_handler=retry_handler)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/connection.py", line 939, in _mexe
request.body, request.headers)
File "/Users/wedonia/work/asociados/server/envs/asociados/lib/python2.7/site-packages/boto/s3/key.py", line 842, in sender
http_conn.send(chunk)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 805, in send
self.sock.sendall(data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 229, in sendall
v = self.send(data[count:])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 198, in send
v = self._sslobj.write(data)
socket.error: [Errno 32] Broken pipe

我的设置如下

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFILES_STORAGE = 's3utils.StaticRootS3BotoStorage'
AWS_S3_ACCESS_KEY_ID = ''
AWS_S3_SECRET_ACCESS_KEY = ''
AWS_STORAGE_BUCKET_NAME = 'asociados.static'

我尝试更改互联网连接并得到相同的结果

我尝试了一个 200k 的文件并得到了相同的结果

有人遇到同样的问题吗?

最佳答案

settings.py 中的 AWS_S3_HOST 设置为您的正确区域,例如s3-eu-west-1.amazonaws.com

AWS_S3_HOST = "s3-eu-west-1.amazonaws.com"

见最新亚马逊list以供完整引用。

gist也很有帮助。

关于python - Django collectstatic boot broken pipe on large file upload,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27388716/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com