1

我尝试从 github 的源代码安装 django-utils 并使用 pip。安装顺利,但queue_command在我的 django 应用程序中不起作用。

因此,按照文档中的建议,我尝试运行“python setup.py test”,但出现以下错误。我不知道如何解决这个问题。我在 mac snow leopard 上的 virtualenv 中运行。

有什么建议么?谢谢你。

running test
running egg_info
writing djutils.egg-info/PKG-INFO
writing top-level names to djutils.egg-info/top_level.txt
writing dependency_links to djutils.egg-info/dependency_links.txt
reading manifest file 'djutils.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'LICENSE.txt'
writing manifest file 'djutils.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    tests_require=['pygments', 'PIL>=0.1.5', 'httplib2'],
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 121, in run
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 101, in with_project_on_sys_path
  File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 130, in run_tests
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/Users/miki725/Development/libs/django-utils/runtests.py", line 43, in <module>
    from django.test.simple import run_tests
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/test/__init__.py", line 5, in <module>
    from django.test.client import Client, RequestFactory
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/test/client.py", line 27, in <module>
    from django.db import close_connection
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/miki725/Development/Django/lib/python2.7/site-packages/django/db/utils.py", line 51, in load_backend
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an available database backend.
Try using django.db.backends.sqlite3 instead.
Error was: No module named base
4

2 回答 2

3

你运行的是什么版本的 Django?1.3 弃用了旧式指定数据库的方式,例如,仅使用“sqlite3”。您现在必须指定整个导入路径,即django.db.backends.sqlite3.

但是,我很确定 1.3 仍然允许您使用旧式方式并且只是对您大惊小怪,警告它已被弃用。也许我错了。如果您正在使用主干,那么几乎可以肯定它已被完全弃用,这使得该错误更容易理解。

总而言之,自从 django-utils 上次更新是在 2009 年以来,它实际上已经死了,而 Django 继续前进。

于 2012-02-06T15:47:15.420 回答
1
  1. 打开你的settings.py
  2. 替换'ENGINE': 'sqlite3','ENGINE': 'django.db.backends.sqlite3',
  3. 节省

再试一次。

于 2012-02-07T11:38:23.110 回答