【问题标题】:SimpleHTTPServer 404 message File not found (trying to load bootstrap.js)未找到 SimpleHTTPServer 404 消息文件(尝试加载 bootstrap.js)
【发布时间】:2014-05-16 17:23:51
【问题描述】:

有人可以解释为什么我会收到以下错误吗?

从以下目录,我正在运行“python -m SimpleHTTPServer”

[blah@blah:~/Dropbox/bootstrap]: ls
css     img     index.html  js

当我在浏览器中访问 localhost:8000/ 时,出现以下错误:

127.0.0.1 - - [16/May/2014 10:22:37] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [16/May/2014 10:22:37] code 404, message File not found
127.0.0.1 - - [16/May/2014 10:22:37] "GET /%E2%80%9Djs/bootstrap.js%E2%80%9D HTTP/1.1" 404 -

是的,在 js 目录中,我有两个文件“bootstrap.js”和“bootstrap.min.js”

我的 index.html 文件如下所示:

<!DOCTYPE html>

<html>

    <head>
        <meta charset="utf-8">
        <title>My First Bootstrap Project</title>


    </head>

    <body>
        <div class="container">

            <h1><a href="#">Bootstrap Site</a></h1>
        </div>


        <link rel=”stylesheet” href=”css/bootstrap.css”  type=”text/css”/>
        <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
        <script src=”js/bootstrap.js”></script>
    </body>

</html>

【问题讨论】:

    标签: python twitter-bootstrap simplehttpserver


    【解决方案1】:

    我认为您的问题可能与您在 HTML 中使用的弯引号(智能引号)有关。相反,请使用常规引号:

    regular: "
    curly (smart): ”
    

    【讨论】:

      【解决方案2】:

      我发现我收到 404 错误的原因是因为我已经有一个进程在端口 8000 上运行;解决方案是先释放端口。

      在 Mac (Linux) 上:

      # If something is running on port 8000, this command will return
      # the process with the process ID (PID) as the 2nd item
      lsof -n -i :8000 | grep LISTEN
      
      # Replace <PID> with whatever PID was returned above
      kill -9 <PID>
      

      之后我就可以在这个端口上运行一个新进程了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-05-22
        • 2022-01-21
        • 2020-05-25
        • 2021-12-19
        • 1970-01-01
        • 2020-08-23
        • 2021-06-13
        • 2015-03-01
        相关资源
        最近更新 更多