1

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

从以下目录中,我正在运行“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”&gt;</script>
    </body>

</html>
4

2 回答 2

1

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

regular: "
curly (smart): ”
于 2014-05-16T17:31:02.503 回答
0

我发现我收到 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>

之后,我能够在这个端口上运行一个新进程。

于 2020-12-06T11:02:42.483 回答