找不到模块django.apps
。它是Django中通常包含的一个模块,因此我不明白这个错误是从哪里来的。
这发生在安装djangorestframework并添加以下行之后:
from rest_framework import routers, serializers, viewsets
CLI输出显示检测到Django 1.6版本:
In [1]: from django.apps import apps
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-380cc652af3e> in <module>()
----> 1 from django.apps import apps
ImportError: No module named apps
In [2]: import django
In [3]: django.VERSION
Out[3]: (1, 6, 11, 'final', 0)
完全例外:
Request Method: GET
Request URL: http://www.somedomain.com/
Django Version: 1.6.11
Exception Type: ImportError
Exception Value:
No module named apps
Exception Location: /usr/local/lib/python2.7/dist-packages/rest_framework/utils/model_meta.py in <module>, line 11
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/home/ubuntu/workspace/djangoserver',
'/home/ubuntu/workspace/djangoserver',
'/home/ubuntu/lib/python/site-packages',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7']
Server time: Thu, 26 Nov 2015 13:25:42 +0000
它就在Django文档中,粗体显示在顶部:
Django 1.7新增功能。
根据您的问题:
Django Version: 1.6.11