IIS 7上没有CSS或JS

2024-04-25 17:02:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在iis7上运行一个Django(1.8)应用程序(通过FastCGI),但是没有呈现css。我为静态内容授予了IIS\u IUSRS权限。我尝试了以下方法:

  1. 在Windows功能中为IIS启用静态内容
  2. 创建了一个指向我的静态文件夹的虚拟目录
  3. 在MIME类型中重新添加了.css
  4. 添加了.css的模块映射

到目前为止,这些措施都没有奏效。除了css中没有样式之外,应用程序中的所有内容都正常工作。在chrome中运行应用程序时,出现以下错误:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/autocomplete_light/style.css".
localhost/:76 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/css/jquery-ui.css".
localhost/:87 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/bower_components/bootstrap/dist/css/bootstrap.min.css".
localhost/:90 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/bower_components/metisMenu/dist/metisMenu.min.css".
localhost/:93 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/dist/css/timeline.css".
localhost/:96 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/dist/css/sb-admin-2.css".
localhost/:99 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/bower_components/font-awesome/css/font-awesome.min.css".
localhost/:102 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/static/w2ui-1.4.3/w2ui-1.4.3.min.css".

Tags: textlocalhosthttphtmlastypewithstatic
1条回答
网友
1楼 · 发布于 2024-04-25 17:02:46

我可以通过允许IUSR帐户来解决这个问题。IIS_IUSRSIUSR都必须有权限。若要添加IUSR,请转到应用程序文件夹->;右键单击->;属性->;安全->;编辑->;添加->;并添加IUSR帐户。帐户应具有读取和执行、列出文件夹内容和读取的权限。你知道吗

添加此帐户后,静态内容(CSS和JS)开始工作。你知道吗

相关问题 更多 >