[英]Testing Twitter bootstrap on Django badges
I currently have twitter bootstrap incorporated on my Django test site but it is not working properly. 我目前在我的Django测试网站上合并了twitter bootstrap,但无法正常工作。
I tested out an example of code on the bootstrap website: http://getbootstrap.com/2.3.2/components.html#labels-badges 我在引导网站上测试了一个示例代码: http : //getbootstrap.com/2.3.2/components.html#labels-badges
All I had on the site is the success badge (green oval with a 2 in the middle) 我在网站上看到的只是成功徽章(绿色椭圆形,中间有2个)
<span class="badge badge-success">2</span>
However, only the oval and the "2" would be displayed but the green color round the "2" is not displayed. 但是,将仅显示椭圆形和“ 2”,但不显示“ 2”周围的绿色。 All I see is a grey oval with a "2" inside.
我所看到的是一个灰色的椭圆形,里面带有“ 2”。 Pretty much the same as the DEFAULT badge on the bootstrap website except there is a "2" instead of a "1".
与引导网站上的DEFAULT徽章几乎相同,除了用“ 2”代替“ 1”。
I was wondering if anyone with Django and twitter bootstrap experience would help me with this issue. 我想知道是否有Django和twitter引导经验的人能帮助我解决这个问题。
Here is my views.py: 这是我的views.py:
from django.http import HttpResponse
from django.template import RequestContext, loader
from django.shortcuts import render, render_to_response
def index(request):
return render(request,'homepage/index.html')
Here is my html file: 这是我的html文件:
{% load staticfiles %}
{% load compressed %}
<!DOCTYPE html>
<head>
{% compressed_js 'bootstrap' %}
{% compressed_css 'bootstrap' %}
</head>
<html>
<body>
<span class="badge badge-success">2</span>
</body>
</html>
Thank you for all the help! 感谢您的所有帮助! much appreciated!
非常感激!
I think your compressed_js and compressed_css does not do the trick. 我认为您的compressed_js和compressed_css不能解决问题。 To check if everything is ok, use for exemple
FireBug
, then press F12 and point your mouse on the badge to see if the CSS rule is display on the left panel. 要检查一切正常,请使用
FireBug
为例,然后按F12并将鼠标指向徽章上,以查看CSS规则是否显示在左侧面板上。 Repeat this step for badge-success to try to find it. 对徽章成功重复此步骤以尝试找到它。
After all of this i'll suggest a more classical way without compressed_xxx : 在完成所有这些之后,我将建议一种不使用compression_xxx的更经典的方式:
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap.min.css" %}" type="text/css" media="screen" />
<link rel="stylesheet" href="{% static "bootstrap/css/bootstrap-responsive.min.css" %}" type="text/css" media="screen" />
where bootstrap
is the folder I put in the static
one I setup in the settings.py
file 其中
bootstrap
是我在settings.py
文件中设置的static
文件夹中放置的文件夹
Hope this will be usefull. 希望这会有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.