python - Exception Certificate Error Thumbnail running django local -


i'm running server django , setting debug true thumbnail, see why thumbnail doesn't show img @ templates , @ call localhost i've received exception

certificateerror @ / hostname 'myhost.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com' enter code here

environment: request method: request url: http://localhost:8000/  django version: 1.6.5 python version: 2.7.9 installed applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'suit', 'tinymce', 'daterange_filter', 'django.contrib.admin', 'import_export', 'south', 'djcelery', 'sorl.thumbnail', 'base', 'accounts', 'app', 'faq', 'marketing', 'website') installed middleware:   ('django.contrib.sessions.middleware.sessionmiddleware',   'django.middleware.locale.localemiddleware',   'django.middleware.common.commonmiddleware',   'django.middleware.csrf.csrfviewmiddleware',   'django.contrib.auth.middleware.authenticationmiddleware',   'django.contrib.messages.middleware.messagemiddleware')    template error:  in template desarrollo/project/templates/includes/class.html, error @ line 82   hostname 'myhost.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com'  72 :             {% else %}    73 :                 {% if item.old_price %}    74 :                     <div class="triangle old"></div>    75 :                     <div class="text-triangle old">    76 :                         <small>ahora</small>    77 :                         <br><span    78 :                             class="price">{{ item.price|exchangeratesymbol:request }}{{ item.price|exchangeratevalue:request }}</span>    79 :                     </div>    80 :                 {% endif %}    81 :             {% endif %}    82 :              {% thumbnail item.preview "600x360" crop="center" im %}     83 :                 <img data-src="{{ im.url }}" src="" alt="{{ item.name }}" class="img-responsive lazy"/>    84 :             {% endthumbnail %}    85 :             <div class="mask">    86 :                 <a href="{% url 'classes-details' item.slug %}"><p><span    87 :                         class="glyphicon glyphicon-play-circle see-more"></span></p></a>    88 :                 <a href="{% url 'classes-details' item.slug %}" class="info">ver más</a>    89 :             </div>    90 :         </div>    91 :     {% endif %}    92 :     <div class="detail_">   traceback:  file "/desarrollo/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/views/generic/base.py" in view 69.             return self.dispatch(request, *args, **kwargs) file "/desarrollo/env/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch  87.         return handler(request, *args, **kwargs)  file "/desarrollo/project/website/views.py" in  124.             context_instance = requestcontext(request)  file "desarrollo/env/local/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response  29.     return httpresponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string  169.         return t.render(context_instance)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  140.             return self._render(context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/base.py" in _render  134.         return self.nodelist.render(context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render  123.         return compiled_parent._render(context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/base.py" in _render  134.         return self.nodelist.render(context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/desarrollo/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render  62.             result = block.nodelist.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render  305.                 return nodelist.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render  196.                         nodelist.append(node.render(context))  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render  155.         return self.render_template(self.template, context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render_template  137.         output = template.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  140.             return self._render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in _render  134.         return self.nodelist.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render  305.                 return nodelist.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/base.py" in render  840.                 bit = self.render_node(node, context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node  78.             return node.render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/sorl/thumbnail/templatetags/thumbnail.py" in render  59.             return self._render(context)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/sorl/thumbnail/templatetags/thumbnail.py" in _render  137.         thumbnail = get_thumbnail(file_, geometry, **options)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/sorl/thumbnail/shortcuts.py" in get_thumbnail  8.     return default.backend.get_thumbnail(file_, geometry_string, **options)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/sorl/thumbnail/base.py" in get_thumbnail  101.         if not thumbnail.exists():  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/sorl/thumbnail/images.py" in exists  111.         return self.storage.exists(self.name)  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/storages/backends/s3boto.py" in exists  414.         return k.exists()  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/s3/key.py" in exists  539.         return bool(self.bucket.lookup(self.name, headers=headers))  file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/s3/bucket.py" in lookup   142.         return self.get_key(key_name, headers=headers)   file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/s3/bucket.py" in get_key   192.         key, resp = self._get_key_internal(key_name, headers, query_args_l)   file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/s3/bucket.py" in _get_key_internal   199.                                                 query_args=query_args)   file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/s3/connection.py" in make_request   664.             retry_handler=retry_handler   file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/connection.py" in make_request   1071.                           retry_handler=retry_handler)   file "/home/kperez/desarrollo/www.pleisi.com/env/local/lib/python2.7/site-packages/boto/connection.py" in _mexe   943.                                        request.body, request.headers)   file "/usr/lib/python2.7/httplib.py" in request   1048.         self._send_request(method, url, body, headers)   file "/usr/lib/python2.7/httplib.py" in _send_request   1088.         self.endheaders(body)   file "/usr/lib/python2.7/httplib.py" in endheaders   1044.         self._send_output(message_body)   file "/usr/lib/python2.7/httplib.py" in _send_output   888.         self.send(msg)   file "/usr/lib/python2.7/httplib.py" in send   850.                 self.connect()   file "/usr/lib/python2.7/httplib.py" in connect   1269.                                                   server_hostname=server_hostname)   file "/usr/lib/python2.7/ssl.py" in wrap_socket   352.                          _context=self)   file "/usr/lib/python2.7/ssl.py" in __init__   579.                     self.do_handshake()   file "/usr/lib/python2.7/ssl.py" in do_handshake   816.             match_hostname(self.getpeercert(), self.server_hostname)   file "/usr/lib/python2.7/ssl.py" in match_hostname   271.             % (hostname, ', '.join(map(repr, dnsnames))))    exception type: certificateerror @ /   exception value: hostname 'myhost.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com' 

this configuration settings.py @ media url , static production:

base_dir = dirname(dirname(__file__))  media_root = join(base_dir, 'media').replace('\\','/') media_url = 'http://myhost.s3.amazonaws.com/' static_root = '' static_url = 'http://myhost.s3.amazonaws.com/'  staticfiles_dirs = (    join(base_dir, 'static').replace('\\','/'), )  staticfiles_finders = (     'django.contrib.staticfiles.finders.filesystemfinder',     'django.contrib.staticfiles.finders.appdirectoriesfinder', ) 

and media , static variables local_settings.py

media_url = '/media/' static_url = '/static/'  cdn = '/static/' 

python introduced strict certificate checking in version 2.7.9 (see pep 476) causes buckets dots in names fail on load. bug on aws site (ref). if remove dots name seems fix issue, or downgrading python 2.7.8 (i think).

i found downgrading python within 2.7 difficult though, commented out code manually.

sudo vim /usr/lib/python2.7/ssl.py line 271

/usr/lib/python2.7/ssl.py in match_hostname                 if key == 'commonname':                     if _dnsname_match(value, hostname):                         return                     dnsnames.append(value)     if len(dnsnames) > 1:         raise certificateerror("hostname %r "             "doesn't match either of %s"                         % (hostname, ', '.join(map(repr, dnsnames)))) ...     elif len(dnsnames) == 1:         raise certificateerror("hostname %r "             "doesn't match %r"             % (hostname, dnsnames[0]))     else:         raise certificateerror("no appropriate commonname or " 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -