开发者

Django, Haystack: show the time took by a search

I have a Django app that uses Haystack. Is it poss开发者_StackOverflow中文版ible to show after a search, in the search result page, how much time the search took ?


You can use the time module from python to achieve that:

import time

start = time.time()
# code which performs search
end = time.time()
time_taken = end - start

Push time_taken to your template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜