现在我的标题有问题。这是我的环境:
之前,我为The Django Book安装了Django 1.1.1。今天,我删除了cmd:sudo apt-get install --purge python-django
的Django 1.1.1,然后获得1.4 pre-alpha的最新版本。
当我关注docs.djangoproject.com上的tutorial并执行cmd:python manage.py shell
时,会出现一些错误并且信息如下:
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 422, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 361, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 355, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/shell.py", line 46, in handle_noargs
from django.db.models.loading import get_models
File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py", line 27, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py", line 81, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/local/lib/python2.6/dist-packages/django/db/utils.py", line 23, in load_backend
return import_module('.base', backend_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named base
有些人可以告诉我如何解决这个问题吗?
谢谢!
答案 0 :(得分:6)
问题可能是因为您的数据库后端没有完整路径。你可能有:
'ENGINE': 'sqlite3',
而不是:
'ENGINE': 'django.db.backends.sqlite3',
答案 1 :(得分:1)
您必须从settings.py所在的文件夹中调用manage.py:../manage.py shell (如果使用sqlite3) (和djando 1.4)