Python Nginx Django应用程序不提供SVG文件

Python Nginx Django应用程序不提供SVG文件,python,django,svg,nginx,Python,Django,Svg,Nginx,因此,我在端口8000上安装了RatticDB安装程序(Django应用程序),在此之前,我在端口80上安装了Nginx。它目前以应用程序/八位字节流的形式提供svg文件,这导致svg文件被下载或提供 rattic.conf: upstream django { server 127.0.0.1:8000; } server { listen 80; server_name locksmith.internal.domain.

因此,我在端口8000上安装了RatticDB安装程序(Django应用程序),在此之前,我在端口80上安装了Nginx。它目前以应用程序/八位字节流的形式提供svg文件,这导致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

显然,Django需要服务于这些以及nginx;因此,问题在Django级别,通过将以下内容添加到settings.py并重新启动uwsgi来解决:

import mimetypes

mimetypes.add_type("image/svg+xml", ".svg", True)
mimetypes.add_type("image/svg+xml", ".svgz", True)

显然,Django需要服务于这些以及nginx;因此,问题在Django级别,通过将以下内容添加到settings.py并重新启动uwsgi来解决:

import mimetypes

mimetypes.add_type("image/svg+xml", ".svg", True)
mimetypes.add_type("image/svg+xml", ".svgz", True)
可能的重复可能的重复