我正在使用带有活塞的 Django 1.5。每当我尝试卷曲以下网址时:
http://127.0.0.1:8000/search/?limit=20&uri=
我收到以下错误:
["NotFound"]
网址模式:
search_resource = Resource(handler=SearchHandler)
urlpatterns = patterns('',
url(r'^', annotation_resource),
url(r'^search/$', search_resource),
)
和请求的处理程序:
class SearchHandler(AnonymousBaseHandler):
allowed_methods = ('GET',)
def read(self, request, id=None):
non_query_args = ['offset', 'limit', 'all_fields']
offset = int(request.GET.get('offset', 0))
limit = int(request.GET.get('limit', 20))
query=dict([(k,v) for k,v in request.GET.items() if not k in non_query_args])
notes = Annotations.find(query).limit(limit).skip(offset) #.sort([(, pymongo.DESCENDING if orderDesc else pymongo.ASCENDING)])
return {'results': [dict([(k,v) if k!='_id' else ('id',v) for k,v in item.items()]) for item in notes],
'total': notes.count()}
由于错误中缺乏详细信息,我无法解决这个问题。/谢谢