当我尝试在 Google App Engine 的数据存储中使用这样的查询时:
user = User.all().filter('name =',userName).get()
我有这个错误:DeadlineExceededError
。
编辑: 这是我的功能:
def feeds(request):
dict = get_user_details()
search_key = None
if request.GET.has_key('search_key'):
search_key = request.GET['search_key']
dict['search_key']=search_key
feeds = list()
if search_key is not None and search_key!="":
feeds_list = Feed.all().order('-CreatedDate')
search_string=string.upper(search_key)
for feed in feeds_list:
feed_name=string.upper(feed.FeedUrl)
if search_string in feed_name:
feeds.append(feed)
dict['search_key']=search_key
else:
feeds = Feed.all().order('-CreatedDate')
if request.GET.has_key('page'):
page = request.GET['page']
try:
page = int(page) - 1
except:
page = 0
paginator = Paginator(feeds,10)
if page>=paginator._get_num_pages():
page = paginator._get_num_pages() - 1
dict["page_obj"] = paginator.page(page+1)
return render_to_response('feed_list.html', dict, context_instance=RequestContext(request))
在Feed上搜索,花费太多时间,提高一个DeadlineExceededError
。