gpt4 book ai didi

django 1.8 教程第 6 部分

转载 作者:行者123 更新时间:2023-12-04 17:01:49 25 4
gpt4 key购买 nike

首先,我意识到 Django 1.8 已经过时了,但我需要为一个项目学习它。我通过前五个部分没有任何问题,但是当我尝试链接第 6 部分中的样式表时,我的样式表没有加载(页面中没有变化)。

我已经多次检查代码并检查了每个文件夹的命名空间,它应该可以工作,但我似乎找不到问题。如果有人已经阅读了本教程并且可以对这个问题有所了解,我将不胜感激。

这是 mysite/polls/templates/polls/index.html 中的代码:

{% load staticfiles %}

<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css'
%}" />


{% if latest_question_list %}

<ul>
{% for question in latest_question_list %}
<li><a href="{% url 'polls:detail' question.id %}">{{
question.question_t\
ext }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}

这是我的样式表,位于 mysite/polls/static/polls/style.css:
li a {
color: green;
}

body {
background: white url("images/background.gif") no-repeat right
bottom;
}

最佳答案

对于遇到相同问题的任何人,重新启动 Django 服务器即可解决问题。

关于django 1.8 教程第 6 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50980539/

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