Django:没有名为应用程序的模块
Django: No module named apps
找不到模块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 docs 中,在顶部以粗体显示:
New in Django 1.7.
根据你的问题:
Django Version: 1.6.11
找不到模块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 docs 中,在顶部以粗体显示:
New in Django 1.7.
根据你的问题:
Django Version: 1.6.11