Django SSL 错误

发布于 2024-09-29 21:39:04 字数 6121 浏览 5 评论 0原文

我似乎收到此错误,并且不知道如何调试它。 有什么指点吗?

回溯(最近一次调用最后一次):

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/handlers/base.py", line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/www/django_test1/omu2/views.py", line 26, in frontIndex
   context_instance=RequestContext(request))

 File "/opt/python2.6/lib/python2.6/site-packages/django/shortcuts/__init__.py", line 20, in render_to_response
   return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader.py", line 108, in render_to_string
   return t.render(context_instance)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
   return self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader_tags.py", line 97, in render
   return compiled_parent.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
   return self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader_tags.py", line 24, in render
   result = self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 946, in render
   autoescape=context.autoescape))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/defaulttags.py", line 243, in render
   return self.nodelist_true.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/defaulttags.py", line 155, in render
   nodelist.append(node.render(context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 826, in render
   output = self.filter_expression.resolve(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 546, in resolve
   obj = self.var.resolve(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 687, in resolve
   value = self._resolve_lookup(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 716, in _resolve_lookup
   current = getattr(current, bit)

 File "/opt/python2.6/lib/python2.6/site-packages/django_imagekit-0.3.3-py2.6.egg/imagekit/specs.py", line 94, in url
   self._create()

 File "/opt/python2.6/lib/python2.6/site-packages/django_imagekit-0.3.3-py2.6.egg/imagekit/specs.py", line 66, in _create
   self._obj._storage.save(self.name, content)

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/files/storage.py", line 46, in save
   name = self.get_available_name(name)

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/files/storage.py", line 71, in get_available_name
   while self.exists(name):

 File "/opt/python2.6/lib/python2.6/site-packages/cumulus/storage.py", line 147, in exists
   self._get_cloud_obj(name)

 File "/opt/python2.6/lib/python2.6/site-packages/cumulus/storage.py", line 99, in _get_cloud_obj
   return self.container.get_object(name)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/utils.py", line 43, in decorator
   return f(*args, **kwargs)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/container.py", line 316, in get_object
   return Object(self, object_name, force_exists=True)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/storage_object.py", line 89, in __init__
   if not self._initialize() and force_exists:

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/storage_object.py", line 462, in _initialize
   'HEAD', [self.container.name, self.name]

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/connection.py", line 200, in make_request
   response = retry_request()

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/connection.py", line 194, in retry_request
   return self.connection.getresponse()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 974, in getresponse
   response.begin()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 391, in begin
   version, status, reason = self._read_status()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 349, in _read_status
   line = self.fp.readline()

 File "/opt/python2.6/lib/python2.6/socket.py", line 397, in readline
   data = recv(1)

 File "/opt/python2.6/lib/python2.6/ssl.py", line 96, in <lambda>
   self.recv = lambda buflen=1024, flags=0: SSLSocket.recv(self, buflen, flags)

 File "/opt/python2.6/lib/python2.6/ssl.py", line 222, in recv
   raise x

SSLError: The read operation timed out

I seem to get this error, and don't know how to debug it.
Any pointers?

Traceback (most recent call last):

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/handlers/base.py", line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/www/django_test1/omu2/views.py", line 26, in frontIndex
   context_instance=RequestContext(request))

 File "/opt/python2.6/lib/python2.6/site-packages/django/shortcuts/__init__.py", line 20, in render_to_response
   return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader.py", line 108, in render_to_string
   return t.render(context_instance)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
   return self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader_tags.py", line 97, in render
   return compiled_parent.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 178, in render
   return self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/loader_tags.py", line 24, in render
   result = self.nodelist.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 946, in render
   autoescape=context.autoescape))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/defaulttags.py", line 243, in render
   return self.nodelist_true.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 779, in render
   bits.append(self.render_node(node, context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 792, in render_node
   return node.render(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/defaulttags.py", line 155, in render
   nodelist.append(node.render(context))

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 826, in render
   output = self.filter_expression.resolve(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 546, in resolve
   obj = self.var.resolve(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 687, in resolve
   value = self._resolve_lookup(context)

 File "/opt/python2.6/lib/python2.6/site-packages/django/template/__init__.py", line 716, in _resolve_lookup
   current = getattr(current, bit)

 File "/opt/python2.6/lib/python2.6/site-packages/django_imagekit-0.3.3-py2.6.egg/imagekit/specs.py", line 94, in url
   self._create()

 File "/opt/python2.6/lib/python2.6/site-packages/django_imagekit-0.3.3-py2.6.egg/imagekit/specs.py", line 66, in _create
   self._obj._storage.save(self.name, content)

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/files/storage.py", line 46, in save
   name = self.get_available_name(name)

 File "/opt/python2.6/lib/python2.6/site-packages/django/core/files/storage.py", line 71, in get_available_name
   while self.exists(name):

 File "/opt/python2.6/lib/python2.6/site-packages/cumulus/storage.py", line 147, in exists
   self._get_cloud_obj(name)

 File "/opt/python2.6/lib/python2.6/site-packages/cumulus/storage.py", line 99, in _get_cloud_obj
   return self.container.get_object(name)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/utils.py", line 43, in decorator
   return f(*args, **kwargs)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/container.py", line 316, in get_object
   return Object(self, object_name, force_exists=True)

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/storage_object.py", line 89, in __init__
   if not self._initialize() and force_exists:

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/storage_object.py", line 462, in _initialize
   'HEAD', [self.container.name, self.name]

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/connection.py", line 200, in make_request
   response = retry_request()

 File "/www/django_test1/omu2/src/python-cloudfiles/cloudfiles/connection.py", line 194, in retry_request
   return self.connection.getresponse()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 974, in getresponse
   response.begin()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 391, in begin
   version, status, reason = self._read_status()

 File "/opt/python2.6/lib/python2.6/httplib.py", line 349, in _read_status
   line = self.fp.readline()

 File "/opt/python2.6/lib/python2.6/socket.py", line 397, in readline
   data = recv(1)

 File "/opt/python2.6/lib/python2.6/ssl.py", line 96, in <lambda>
   self.recv = lambda buflen=1024, flags=0: SSLSocket.recv(self, buflen, flags)

 File "/opt/python2.6/lib/python2.6/ssl.py", line 222, in recv
   raise x

SSLError: The read operation timed out

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的痛♀有谁懂 2024-10-06 21:39:04

我是 django-cumulus 的作者。 Cloud Files 因 SSL 连接问题而臭名昭著。 django-cumulus 有一个名为 CUMULUS_TIMEOUT 的设置(在 0.3.6 中添加),默认为 5 秒。您可以将其增加到 10 或 15 来尝试缓解这种情况。

请参阅 https://github.com/richleland/django-cumulus/issues/5 了解更多信息,如果您仍然遇到问题,请随时在那里发布问题。

I'm the author of django-cumulus. Cloud Files is notorious for SSL connection issues. django-cumulus has a setting (added in 0.3.6) called CUMULUS_TIMEOUT that defaults to 5 seconds. You can increase it to 10 or 15 to try and alleviate this.

See https://github.com/richleland/django-cumulus/issues/5 for more info and feel free to post an issue there if you continue to experience problems.

虫児飞 2024-10-06 21:39:04

从表面上看,我想说与 Rackspace Cloudfiles 的连接超时了。 Imagekit 动态构建缩略图(我相信它是在 _create() 中执行的),但还有一个选项可以在保存模型时创建所有缩略图,而不是在渲染时创建。如果 Rackspace 出现故障,这并不会真正帮助您,但它将有助于缩短渲染模板所需的时间。

编辑:
要预缓存缩略图,您可以更改 ImageSpec 定义以包含 pre_cache = True 例如(来自 imagekit wiki):

from imagekit.specs import ImageSpec 

class Thumbnail(ImageSpec): 
    access_as = 'thumbnail_image' 
    pre_cache = True 

如果您更改规格,您可以使用 ikflush 管理命令重新构建所有缓存的缩略图。您应该注意,虽然这将创建 pre_cache = True 的所有缩略图,但也会删除 pre_cache = False 的所有缓存图像。

From the look of it I would say that the connection to Rackspace Cloudfiles timed out. Imagekit builds the thumbnails dynamically (which I believe it was doing here in _create()) but there is also an option to create all the thumbnails when the model is saved as opposed to while rendering. That won't really help you if Rackspace goes down but it will help lower the time it takes to render your templates.

EDIT:
To pre-cache your thumbnail you change your ImageSpec definition to include pre_cache = True such as (from the imagekit wiki):

from imagekit.specs import ImageSpec 

class Thumbnail(ImageSpec): 
    access_as = 'thumbnail_image' 
    pre_cache = True 

If you change your specs you can re-build all of the cached thumbnails with the ikflush management command. You should note that while this will create all the thumbnails where pre_cache = True this will also delete all the cached images where pre_cache = False.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文