4

I used wagtail-generator with yoeman to generate a wagtail django project and svg files served by django with django.contrib.staticfiles output application/octet-stream mimetype instead of image/svg+xml mimetype which breaks picture rendering.

I tried this solution without success but I'm sure that using something like nginx to serve static files would fix this (did not try yet).

Based on this answer to another of my questions, I can copy wagtail's template in my templates so I can change the admin logo, but it doesn't fix the svg problem ;)

What I'm getting right now:

wagtail with broken svg logo

And here's the response from Chrome network tab in case it could help:

Chrome network tab

$ wget http://localhost:8000/static/wagtailadmin/images/wagtail-logo.svg

output:

--2014-07-02 16:14:36--  http://localhost:8000/static/wagtailadmin/images/wagtail-logo.svg
Resolving localhost... 127.0.0.1, ::1, fe80::1
Connecting to localhost|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3082 (3.0K) [application/octet-stream]
Saving to: 'wagtail-logo.svg'

100%[=============================================================>] 3,082       --.-K/s   in 0.006s

2014-07-02 16:14:36 (466 KB/s) - 'wagtail-logo.svg' saved [3082/3082]
Community
  • 1
  • 1
GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
  • 1
    We faced this issue yesterday - The issue is, your nginx configuration needs to set the right mime-type for SVG (If not specified as an image type, it takes it as an octet stream.) Hence the issue - To verify, curl the image in verbose mode and see the mime-type – karthikr Jul 02 '14 at 20:12
  • 1
    I did not try to serve static files with nginx yet (I supposed it should work fine with nginx), problem is with static files being served *by django*, I just edited my question to add `wget` output. – GabLeRoux Jul 02 '14 at 20:28
  • Possible duplicate of [Can the Django dev server correctly serve SVG?](https://stackoverflow.com/questions/2312714/can-the-django-dev-server-correctly-serve-svg) – bubbassauro Feb 23 '18 at 21:17
  • facing the same issue with django 1.11 – Abhishek Lodha May 12 '19 at 10:52

0 Answers0