我正在尝试为 python 获得一些 GAE 分页,但我什至无法让教程(https://docs.djangoproject.com/en/dev/topics/pagination/)正常工作。我在这里看到关于去哪里的相互矛盾的反应。这是我正在使用的代码:
class EditCompanyHandler(webapp.RequestHandler):
# https://docs.djangoproject.com/en/dev/topics/pagination/
def get(self):
company_list = Company.all()
paginator = Paginator(company_list, 25)
You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see https://developers.google.com/appengine/docs/python/tools/libraries#Django
E 2012-05-25 06:31:36.341
<type 'exceptions.ImportError'>: cannot import name Paginator
Traceback (most recent call last):
File "/base/data/home/apps/s~XX/1.359153909296057586/showcompanies.py", line 24, in <module>
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
I 2012-05-25 06:31:36.343
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
我正在寻找一种直接的分页方式。
如果我将 djnago 版本更新到 1.1,我会得到以下信息:
<type 'exceptions.ImportError'>: cannot import name Paginator
Traceback (most recent call last):
File "/base/data/home/apps/s~biomapit/1.359154059826228765/showcompanies.py", line 25, in <module>
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger