1.看了《学习CSS布局》 ,收获不小。以后可以把这个教程和w3cshool的css教程结合起来复习,当作工具书。
2.float布局,注意clear的使用。inline-block布局,多考虑。fixed和absolute。。。。
3.博客相册页面函数的代码尾端如下:
bucket = Bucket('hugstore')
bucketr = Bucket('thumbnail')
bucket.put()
UrlList = [(bucket.generate_url(i['name']),bucketr.generate_url(i['name']),str(bucket.stat_object(i['name']).get('last_modified'))[:10]) for i in bucket.list()] # 获取的图片地址,哈哈哈哈
return render_template('album.html',UrlList = UrlList)
相对应的html模版为:
{% for (url,urlr,uptime) in UrlList %}
<div class="album ">
<div class="albumimg">
<img src={{urlr}}>
</div>
<div style="clear:both;"></div>
<a href={{url}}>原图</a>上传时间:{{uptime}}<!--{{uptime}}-->
</div>
{% endfor %}
结果总是 报错:
Traceback (most recent call last):
File "/usr/local/sae/python/lib/python2.7/site-packages/sae/__init__.py", line 18, in new_app
return app(environ, start_response)
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1306, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1294, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1062, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1060, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/app.py", line 1047, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/data1/www/htdocs/619/ixphone/1/myapp.py", line 312, in album
return render_template('album.html',UrlList = UrlList)
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/templating.py", line 121, in render_template
context, ctx.app)
File "/usr/local/sae/python/lib/python2.7/site-packages/flask/templating.py", line 105, in _render
rv = template.render(context)
File "/usr/local/sae/python/lib/python2.7/site-packages/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "/data1/www/htdocs/619/ixphone/1/templates/album.html", line 1, in top-level template code
{% extends 'layout.html' %}
ValueError: too many values to unpack
我可是严格审查了的啊。三个值的元组,列表解析。然后解包。没问题啊!!