0
我正在使用Django Rest Framework。當我嘗試去招搖文檔頁面, 我得到 導入錯誤:沒有模塊名爲drf_compound_fields如何調試ImportEror「No Module named ...」
from serializers.py where I try to import the following
from drf_compound_fields.fields import ListField
我已經DRF-複合場0.2.2在我的virtualenv,我跑了PIP list命令,使確定它已安裝。
以下是我從manage.py殼獲得
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
>>>
感謝您的幫助!
你將它添加到您的INSTALLED_APPS在你的settings.py? – 2014-11-21 16:56:28
我沒有。 drf_compound_fields文檔沒有要求將任何內容添加到settings.py中。我看到你的評論後就試過了它給了我ImportError:啓動時沒有名爲drf-compound-fields的模塊。 – trex 2014-11-21 17:20:58
你確定你用同樣的virtualenv運行pip list和django應用程序嗎? – likeon 2014-11-21 18:44:02