在Django徽章上测试Twitter bootstrap [英] Testing Twitter bootstrap on Django badges

查看:93
本文介绍了在Django徽章上测试Twitter bootstrap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的Django测试网站上已经安装了twitter bootstrap,但是它不能正常工作。



我测试了引导网站上的代码示例: http://getbootstrap.com/2.3.2/components.html#labels-badges



我所有的该网站是成功徽章(绿色椭圆形,中间有2个)

 < span class =徽章徽章 - 成功> 2'; /跨度> 

但是,只有椭圆和2才会显示,但是2 不显示。我看到的是一个灰色的椭圆形,里面有一个2。与引导网站上的DEFAULT徽章完全相同,除了2而不是1。



我想知道有没有Django和twitter bootstrap经验将帮助我解决这个问题。



这是我的views.py:

 code> 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')

这是我的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>

感谢您的帮助!非常感谢!

解决方案

我认为你的compressed_js和compressed_css没有做到这一点。
要检查一切是否正常,请使用例如 FireBug ,然后按F12并将鼠标指向徽章,以查看CSS规则是否显示在左侧面板。重复此步骤以获取徽章,以尝试找到它。



所有这一切,我将建议一种更经典的方式,而不使用compressed_xxx:

 < link rel =stylesheethref ={%staticbootstrap / css / bootstrap.min.css%}type =text / cssmedia =screen/> 
< link rel =stylesheethref ={%staticbootstrap / css / bootstrap-responsive.min.css%}type =text / cssmedia =screen/>

其中 bootstrap 是我放入的文件夹 static 一个我在 settings.py 文件中设置



希望这将是有用的。


I currently have twitter bootstrap incorporated on my Django test site but it is not working properly.

I tested out an example of code on the bootstrap website: 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)

    <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. All I see is a grey oval with a "2" inside. Pretty much the same as the DEFAULT badge on the bootstrap website except there is a "2" instead of a "1".

I was wondering if anyone with Django and twitter bootstrap experience would help me with this issue.

Here is my 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:

    {% 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. 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. 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 :

<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

Hope this will be usefull.

这篇关于在Django徽章上测试Twitter bootstrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆