gpt4 book ai didi

python - 未应用 CSS

转载 作者:太空宇宙 更新时间:2023-11-03 18:44:25 25 4
gpt4 key购买 nike

我在应用我的 CSS 时遇到了一些问题。 (我正在使用 Django 1.5)

这是我的元素结构:

project
- app
- project
- static
- css
- style.css
- template
- index.html

我的设置是默认设置,除了添加我的数据库设置。

这是我的 index.html 对 css 的引用:

{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>app</title>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
</head>
<body>
</body>
</html>

我的 style.css 位置错误是 404:

[24/May/2013 17:24:57] "GET /static/css/style.css HTTP/1.1" 404 1676

如果有人可以让我知道我错过了哪一部分,我将不胜感激。谢谢!

最佳答案

如果您的设置是默认设置,我认为它无法工作。你必须告诉 Django 在哪里提供静态文件。您在设置文件中执行此操作。

这应该有帮助:https://docs.djangoproject.com/en/dev/howto/static-files/

关于python - 未应用 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16731694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com