Django development server and MIME types

心已入冬 提交于 2020-01-11 08:10:09

问题


Is there anyway of setting MIME types in the django development server? Specifically, I would love to remove this message from the warnings in Chrome dev tools.

Resource interpreted as Image but transferred with MIME type image/x-png

回答1:


Turns out it was as simple as adding

if DEBUG:
    import mimetypes
    mimetypes.add_type("image/png", ".png", True)

to settings.py



来源:https://stackoverflow.com/questions/16303098/django-development-server-and-mime-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!