Note that there are some explanatory texts on larger screens.

plurals
  1. PODjangoUnicodeDecodeError on static image
    text
    copied!<p>I am getting this error when trying to include a static image in Django. </p> <pre><code>Traceback (most recent call last): File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response) File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__ return self.application(environ, start_response) File "/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line 245, in __call__ response = middleware_method(request, response) File "/Users/Josh/djcode/lists/debug_toolbar/middleware.py", line 105, in process_response smart_unicode(response.content), File "/Library/Python/2.6/site-packages/django/utils/encoding.py", line 39, in smart_unicode return force_unicode(s, encoding, strings_only, errors) File "/Library/Python/2.6/site-packages/django/utils/encoding.py", line 88, in force_unicode raise DjangoUnicodeDecodeError(s, *e.args) DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: unexpected code byte. You passed in '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00P\x00\x00\x00H\x08\x06\x00\x00\x00a\x94r[\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\nOiCCPPhotoshop ICC profile\x00\x00x\xda\x9dSgTS\xe9\x16=\xf7\xde\xf4BK\x88\x80\x94KoR....`\x82' (&lt;type 'str'&gt;) </code></pre> <p>I am using this to serve my static media:</p> <pre><code>if settings.DEBUG: urlpatterns += patterns('', (r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}), ) </code></pre> <p>and here is my settings.py (having tried the STATIC_ROOT with and without the trailing slash:</p> <pre><code>STATIC_URL = '/media/' STATIC_ROOT = '/Users/Josh/djcode/static_media' </code></pre> <p>CSS and javascript files work fine, however images do not. Here is my HTML: <code>&lt;img src="/media/img/new_list_button.png" alt="Make a new list."/&gt;</code></p> <p>Thanks in advance for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload