【发布时间】:2021-10-18 05:04:44
【问题描述】:
这是我项目的文件结构。
我在 testpage.html 中添加了一个链接,我希望它能够将用户带回到根目录(本地服务器上的http://127.0.0.1:8000),该目录配置为使用 index.html 作为 pages > templates > 下的主页索引。
testpage.html 如下。链接在第 3 行(当前为空):
<h1 class='list'>Classes</h1>
{% if mydata %}
<a href="">Go home</a>
{% endif %}
{% for k in mydata %}
<table border="1">
<thead>
<th>Team</th>
<th>Name</th>
<th>ClassCode</th>
</thead>
<tr>
<td>{{k.Team}}</td>
<td>{{k.Name}}</td>
<td>{{k.ClassCode}}</td>
</tr>
</table>
{% endfor %}
{% endblock %}
【问题讨论】:
标签: python python-3.x django django-templates