【发布时间】:2024-05-23 15:50:02
【问题描述】:
引导程序未命中 HTML。 我使用 Flat UI 的 Bootstrap。 我写在 index.html 之类的
{% load staticfiles %}
<html lang="ja">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="{% static './bootflat.github.io/bootflat/css/bootflat.min.css' %}">
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<style>
body {
padding-top: 70px;
}
.my-form {
width: 640px;
margin: 0 auto;
}
@media screen and (max-width: 768px) {
.my-form {
width: 100%;
}
}
.errorlist li {
list-style-type: none;
}
.errorlist {
color: red;
margin-left: 0;
padding-left: 0;
}
</style>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<p class="navbar-text">Hello</p>
{% if user.is_authenticated %}
<p class="navbar-text">{{ user.get_username }}</p>
{% endif %}
</div>
</nav>
<div class="container">
{% block content %}
{% endblock %}
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script>
</body>
</html>
我指定了像<link rel="stylesheet" href="{% static './bootflat.github.io/bootflat/css/bootflat.min.css' %}">这样的Flat UI的文件夹路径,但设计没有改变。我访问了http://localhost:8000/static/bootflat.github.io/bootflat/css/bootflat.min.css,but找不到页面(404)请求方法:GET请求URL错误,所以我认为路径错误。
目录结构是
index.html 在accounts.accounts 文件夹结构是
我的代码有什么问题?我应该如何解决这个问题?
【问题讨论】:
-
先跟着教程学习一下django项目的结构。
标签: python html django bootstrap-4