导入Django项目运行程序,其中一个页面报如下错误
(index):1 Refused to execute script from ‘http://xxxxxx/js/keyword_h.js’ because its MIME type (‘application/x-js’) is not executable, and strict MIME type checking is enabled.
因为其MIME类型(“application/x-js”)不可执行,并且启用了严格的MIME类型检查。
'''
下面是解决方法(尝试放在静态文件路径下也是可以的,
不过这不是我想要的解决方案)
'''
'''
在settings.py操作.读取js类型
'''
import mimetypes
mimetypes.add_type("text/javascript", ".js", True)