如何安装django-utils?

时间:2012-02-06 15:30:23

标签: python django installation virtualenv django-extensions

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

正如docs中所建议的,我尝试运行`python setup.py test',我收到以下错误。我不知道如何解决这个问题。我在mac snowalen的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

2 个答案:

答案 0 :(得分:3)

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

但是,我很确定1.3仍然让你使用旧式的方式,只是对你嗤之以鼻,警告它已被弃用。也许我错了。如果你正在运行主干,那么,它几乎肯定已完全弃用,这使得这个错误更容易理解。

长期和短期是自从上次更新django-utils回到了2009年以来,它实际上已经死了,而且Django继续前进。

答案 1 :(得分:1)

  1. 打开您的settings.py
  2. 'ENGINE': 'sqlite3',替换为'ENGINE': 'django.db.backends.sqlite3',
  3. 保存
  4. 再试一次。