解决使用drf-haystack报错ImportError: cannot import name get_count
2018-06-27 13:28
645 查看
版权声明:转载请注明出处 https://blog.csdn.net/fanlei5458/article/details/80827840
文件路径 虚拟环境下的
如果在配置完haystack并启动程序后,出现如下异常,是因为drf-haystack还没有适配最新版本的REST framework框架
可以通过修改
REST framework框架代码,补充
_get_count函数定义即可
文件路径 虚拟环境下的
lib/python3.6/site-packages/rest_framework/pagination.py
def _get_count(queryset): """ Determine an object count, supporting either querysets or regular lists. """ try: return queryset.count() except (AttributeError, TypeError): return len(queryset)阅读更多
相关文章推荐
- ImportError: cannot import name ABCMeta 问题解决
- 解决pdfminer ImportError: cannot import name process_pdf
- ImportError: cannot import name ‘WordCloud’ pip 时 error: Microsoft Visual C++ 14.0 is required. Get
- 解决ImportError:cannot import name xmlrpc_client问题
- 解决安装pymongo报错 ImportError: cannot import name MongoClient
- 解决bs4在Python 3.6下出现“ImportError: cannot import name 'HTMLParseError'”错误
- 使用sklearn时cannot import name MLPClassifier的解决办法
- 解决 ImportError: cannot import name pywrap_tensorflow
- 安装comtypes 0.6.2时ImportError: cannot import name DistutilsOptionError 解决办法
- 解决ImportError: cannot import name HTTPConnection的方法
- 如何解决ImportError: cannot import name BeautifulSoup 或者 ImportError: No module named BeautifulSoup
- 解决ImportError: cannot import name webdriver
- 解决bs4在Python 3.5下出现“ImportError: cannot import name 'HTMLParseError'”错误
- python MySQLdb ImportError: cannot import name conversions 解决办法
- 解决 ImportError: cannot import name imsave 的报错问题
- 解决ImportError: cannot import name webdriver
- Python2下ImportError: cannot import name 'urlopen'问题解决
- 解决ImportError: cannot import name xxx
- Django+haystack实现全文搜索出现错误 ImportError: cannot import name signals
- python scrapy 使用时报错 cannot import name xmlrpc_client