【发布时间】:2015-10-08 14:43:07
【问题描述】:
我的 django 框架在导入“PaginationSerializer”时抛出错误。知道可能出了什么问题吗?请在引发错误的行下方找到。我正在使用 django REST framework 3.1 版本。
from rest_framework.pagination import PaginationSerializer
下面是错误输出。
ImportError at /
cannot import name 'PaginationSerializer'
Request Method: GET
Request URL: http://127.0.0.1:3434/
Django Version: 1.8.2
Exception Type: ImportError
Exception Value: cannot import name 'PaginationSerializer'
Exception Location: /home/djangoDevelopment/test.git/rest_peace/urls.py in <module>, line 9
Python Executable: /home/pulak/djangoDevelopment/django-test.git/djenv/bin/python
Python Version: 3.4.3
【问题讨论】:
-
您是否在设置中将
rest_framework添加到INSTALLED_APPS -
是的,当然。其他进口例如路由器,序列化器工作正常!!
-
你用的是哪个版本?
-
我使用的是 REST framework 版本 3.1。
-
PaginationSerializer在 DRF 3.1 版本中被删除。
标签: django django-rest-framework