我正在使用Django Rest Framework。当我尝试去swagger docs页面时, 我正进入(状态 ImportError:没有名为drf_compound_fields的模块
from serializers.py where I try to import the following
from drf_compound_fields.fields import ListField
我的virtualenv中有drf-compound-field 0.2.2,我运行了pip list命令以确保它已安装。
以下是我从manage.py shell获得的内容
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
>>>
>>>
>>>
>>> from drf_compound_fields.fields import ListField
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named drf_compound_fields.fields
>>>
感谢您的帮助!!
答案 0 :(得分:0)
drf-compound-fields
安装在运行django服务器的相同virtualenv下。
显然,它需要在系统级别安装,而不一定是在virtualenv级别。
按照以下步骤在系统级安装drf-compound-fields
软件包: