def index(): """主页面""" # TODO 获取前10条 _db = DBHelper() data = _db.select() for row in data: row['alias'] = row['alias'] or row['id'] text = row['content'] row['content'] = text[:40].strip() + '...' if len(text) >= 40 else text return render_template("index.html", data=data)