在 FireBug 上,我收到这些错误
GET http://localhost:8000/static/bootstrap/css/bootstrap.min.css 404 (NOT FOUND) localhost/:7
GET http://localhost:8000/static/bootstrap/js/bootstrap.min.js 404 (NOT FOUND) localhost/:8
GET http://localhost:8000/static/bootstrap/css/bootstrap.min.css 404 (NOT FOUND)
我的 STATIC_ROOT 是:
STATIC_ROOT = '/home/bradford/Development/Django/public_pictures/static'
我将引导文件放在“静态”目录中。这个“静态”目录位于我的名为“public_pictures”的项目中。我不确定为什么找不到这些文件
这是我的 HTML 文件:
<!DOCTYPE html>
{% load staticfiles %}
<head>
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap.min.css" %}" type="text/css" media="screen" />
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.min.js" %}" ></script>
</head>
<html>
<body>
<span class="badge badge-success" >HI!</span>
<span class="badge">1</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-important">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>
</body>
</html>
因此,这些引导标记仅显示常规文本。
感谢您的任何意见谢谢!
** * ** *编辑* ** * ** * ** * ***
所以到目前为止我在 settings.py 中的 STATICFILES_DIRS 是
STATICFILES_DIR = ('/home/bradford/Development/Django/public_pictures/static',)
STATIC_ROOT = '', # blank
STATIC_URL = '/static/'
DEBUG = True
网址.py:
from django.conf.urls import include, url, patterns
urlpatterns = patterns('',
url(r'homepage/',include('homepage.urls', namespace = "homepage")),
)
index.html(模板)
<!DOCTYPE html>
{% load staticfiles %}
<head>
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap.min.css" %}" type="text/css" media="screen" />
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.min.js" %}" ></script>
</head>
<html>
<body>
<span class="badge badge-success" >HI!</span>
<span class="badge">1</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-important">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>
</body>
</html>
所有这些变化让我离我的目标更近了一点。但是,会显示引导程序的标记,但没有显示颜色。一切都是灰色的,带有白色文本=[我不确定其他功能是否也能正常工作。我会试试的。再次感谢大家的帮助!非常感激!