【发布时间】:2020-08-22 03:50:35
【问题描述】:
这是一个非常基本的问题,但过去一周我一直在努力解决这个问题。我刚开始将 CSS 添加到我的项目中,并将 base_style.css 链接到 base.html。由于某种原因,服务器找不到 base_style.css。
Base.html:
<head>
<title> Chat </title>
<link href = "base_style.css" type = "text/css" rel = "stylesheet">
</head>
base_style.css:
h1 {
text-align: center;
}
但是,当我通过命令提示符运行服务器时,我得到:
[21/Aug/2020 23:35:25] "GET / HTTP/1.1" 200 517
Not Found: /base_style.css
[21/Aug/2020 23:35:25] "GET /base_style.css HTTP/1.1" 404 5153
即使通过base_style.css和base.html都在同一个文件夹/目录中:
08/18/2020 07:48 PM <DIR> .
08/18/2020 07:48 PM <DIR> ..
08/21/2020 11:24 PM 584 base.html
08/21/2020 11:24 PM 51 base_style.css
08/17/2020 12:05 AM 622 chatroom.html
08/13/2020 05:03 PM 418 chatrooms.html
08/15/2020 09:53 PM 376 edit_message.html
08/13/2020 05:00 PM 295 index.html
08/13/2020 05:06 PM 272 new_chatroom.html
08/14/2020 04:00 PM 378 new_message.html
8 File(s) 2,996 bytes
2 Dir(s) 417,867,866,112 bytes free
如果有人知道发生了什么,我很感激任何帮助。
【问题讨论】:
-
你用什么服务器运行这个?
-
我在命令提示符终端上运行它,只使用 python manage.py runserver,然后在 chrome 上打开 127.0.0.1:8000。我也试过通过heroku运行它,它也没有工作(但没有错误消息)