@x.route('/index.php?q=<key>')
@x.route('/search/<key>')
@x.route('/search/<key>/<int:page>')
def search_view(key, page=1):
global keys
k = key.replace('-',' ')
dic = dict(
videos=Video.objects.search_text(k).paginate(page=page, per_page=24),
page=page,
key=k,
title='%s - page %s' % (key, page)
)
if key not in keys:
keys.append(key)
if len(keys) >= 25:
keys = keys[-1:-26:-1]
f = open('search.txt', 'w+')
for k in keys:
f.write('%s\n' % k)
f.close()
g.keys = keys
return render_template('search.html', **dic)
以上配置访问search/很正常,但访问/index.php?q=就404了。请问问题出在哪里?
1
sujin190 2015-03-14 23:46:51 +08:00
url路由定义不包括查询差数,查询参数通过request取得
|