我已经在我的Ubuntu 16.04中安装了Django(1.8.2) 当我将一个工作项目克隆到它并运行服务器时,我收到以下错误。
Traceback (most recent call last):
File "manage.py", line 31, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/lib/python2.7/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python2.7/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/lib/python2.7/django/apps/config.py", line 119, in create
import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
观察:
INSTALLED_APPS
中settings.py
的值为:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Telecommands',
'Telemetry',
'captcha',
'django.contrib.sitemaps',
'djcelery',
'kombu.transport.django',
# 'grappelli',
# 'chronograph',
# 'registration', # Include the registration
)
我尝试了什么?
pip install django==1.8.2
安装django。 /usr/lib/python2.7/
报告了错误,因此
我试过了:sudo pip install --install-option="--install-purelib=/usr/lib/python2.7/site-packages/" --ignore-installed django==1.8.2
/usr/local/lib/python2.7/dist-packages
,/usr/lib/python2.7/dist-packages/
~/.local/lib/python2.7/dist-packages
我逐一将django(1.8.2)安装到这些路径中
并行更新PYTHONPATH
。 有人可以帮助我吗?请解释错误的原因。
答案 0 :(得分:4)
回溯显示/usr/lib/python2.7/django/__init__.py
中发生错误,因此manage.py
已清楚地找到您的Django安装。顺便说一句,使用虚拟环境而不是安装在/usr/lib/python2.7/site-packages/
中会好得多。
问题似乎是kombu.transport.django
中有INSTALLED_APPS
。 Django transport was removed from kombu in 4.0。