2015-09-18 49 views
1

所以我有一個端口8000上的RatticDB安裝設置(Django應用程序),並在前面,我有端口80上的Nginx。它目前服務svg文件作爲應用程序/八位字節流導致svg文件被下載vs服務。Nginx的Django應用程序沒有提供SVG文件

rattic.conf:

upstream django { 
    server  127.0.0.1:8000; 
} 

server { 
    listen   80; 
    server_name   locksmith.internal.domain.com; 
    charset   utf-8; 
    client_max_body_size 75M; 

    location /raddicweb/static { 
    alias  /home/locksmith/RatticWeb/ratticweb/static; 
    } 

    location /cred/static { 
    alias  /home/locksmith/RatticWeb/cred/static; 
    } 

    location/{ 
    uwsgi_pass django; 
    include  /etc/nginx/uwsgi_params; 
    } 

    types { 
    image/svg+xml svg svgz; 
    } 

    } 

現在nginx.conf包括MIME類型和MIME類型有這一套,我在哪裏何去何從? [root @ ip〜]#grep -R mime.types/etc/nginx/ /etc/nginx/nginx.conf:include /etc/nginx/mime.types; [root @ ip〜]#grep svg /etc/nginx/mime.types image/svg + xml svg svgz;

+0

的[?能Django的開發服務器正確投放SVG(可能的複製https://stackoverflow.com /問題/ 2312714 /罐的,Django的DEV-服務器正確發球-SVG) – bubbassauro

回答

0

顯然,Django需要服務於這些以及nginx;所以,問題是在Django的水平,並通過添加以下內容的settings.py並重新啓動uwsgi解決:

import mimetypes 

mimetypes.add_type("image/svg+xml", ".svg", True) 
mimetypes.add_type("image/svg+xml", ".svgz", True) 
相關問題