Python爬虫实战笔记_4-3 Semantic UI

Reference:
Semantic UI

Get problem when install GULP, below are references to solve it.
learnsemantic
npm instll gulp
installing-npm-packages-globally
fixing-npm-permissions
About how to solve "Command not found"

My Pinterest layout
  • Firstly, <div class="ui basic segment">.
  • Secondly, <div class="ui five column grid">, use a 'five column grid' to make the page show five columns in a row.
  • Then, there are five <div class="column"> to represent each column.
  • Lastly, in each column, put numbers of <div class="ui fluid card"> to make it the layout of 'pinterest'

<div class="ui basic segment">
    <div class="ui five column grid">
        <div class="column">
            <div class="ui fluid card">
                    <div class="image" >
                        <img src="src/img/003.jpg">
                    </div>
                <div class="content">
                    <div class="header">
                        Elliot Fu
                    </div>
                    <div class="meta">
                        Friends of Veronika
                    </div>
                    <div class="description">
                         Elliot 
                    </div>
                </div>
                <div class="extra content">
                    extra
                </div>
            </div>
            <div class="ui fluid card">...</div>
            ...
        </div>
        <div class="column">
            <div class="ui fluid card">...</div>
            ...
        </div>
        <div class="column">
            <div class="ui fluid card">...</div>
            ...
        </div>
        ....
    </div>
</div>

The structure, though ugly.

Screen Shot 2016-07-23 at 10.38.02 AM.png
Define a new view in views.py

Separate all data into five parts, each for one column.

def zinterest(request):
    mdata = ZufangList.objects
    length = len(mdata)
    each = int(length /5)
    datalist = []
    for i in range(5):
        datalist.append(mdata[0 + each * i: each + each * i])
    context = {
        'zindata': mdata,
        'c1': datalist[0],
        'c2': datalist[1],
        'c3': datalist[2],
        'c4': datalist[3],
        'c5': datalist[4],
    }
    return render(request, 'zinterest.html', context)
最终效果

用从小猪爬取到的数据生成页面

页中


Screen Shot 2016-07-23 at 12.40.48 PM.png

页尾


Screen Shot 2016-07-23 at 12.52.11 PM.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 11,744评论 0 23
  • 01 安平来到张拥军阿姨的家,跟张阿姨说明来意。 张姨叹了口气,说:“安平,阿姨也先道歉,要不是让你听到我跟你爸爸...
    风七阳阅读 403评论 27 27
  • 广州一个拥有悠久历史的城市,一个最早和外国人通商的口岸,一个全国最重要的大城市。在这个城市的标致性建筑物下面,开始...
    青春彡阅读 271评论 0 0
  • 朋友和喜欢的人真的很不同,朋友可以无话不谈,而喜欢的人却不是。 中国文化里的朋友是"君子之交淡如水"。而西方文化里...
    拾起一片枫叶fly阅读 219评论 2 0
  • 纸质书,或许终究无力抵抗时代的变迁,但作为读书人,我,会将纸质版的读书,坚持到底。
    蜗牛吃韭菜阅读 229评论 0 0

友情链接更多精彩内容