老师我的网站找不到服务器不知道是什么原因造成的,拼写我也检查了没有错。

来源:8-11 显示搜索结果页面

jingjing_0005

2018-05-22

http://img.mukewang.com/szimg/5b03ffbd0001a5ca10150510.jpg

http://img.mukewang.com/szimg/5b04001b0001109310300220.jpg


@web.route('/book/search')
def search():
   form = SearchForm(flask.request.args)
   books = BookCollection()
   if form.validate():
       q = form.q.data.strip()
       page = form.page.data
       isbn_or_key = is_isbn_or_key(q)
       yushu_book = YuShuBook()
       if isbn_or_key == 'isbn':
           yushu_book.search_by_isbn(q)
       else:
           yushu_book.search_by_keywrod(q, page)
       books.fill(yushu_book, q)
   else:
       flask.flash('key word can\'t be found, please input another word')
   return flask.render_template('search_result.html', books=books)



写回答

1回答

Hozz

2018-06-02

flask.flash('key word can\'t be found, please input another word')
   return flask.render_template('search_result.html', books=books)

多了个flask  改

flash('key word can\'t be found, please input another word')
   return render_template('search_result.html', books=books)

0
1
jingjing_0005
非常感谢!
2018-06-07
共1条回复

Python Flask高级编程之从0到1开发《鱼书》精品项目

7月老师深入浅出剖析Flask核心机制,和你一起探讨Python高级编程

2752 学习 · 1277 问题

查看课程