开发者

Django SSL error

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/开发者_StackOverflow社区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'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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜