无法与Django和mongoDB一起运行syncdb

时间:2012-05-09 09:56:59

标签: django mongodb django-nonrel

我从github获得django-nonreldjangotoolboxmongodbenginesetting.py如下:

DATABASES = {
    'default': {
        'ENGINE': 'django_mongodb_engine', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'admin',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
} 

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
)

ROOT_URLCONF = 'ptl.urls'

TEMPLATE_DIRS = ('/Users/bxshi/PycharmProjects/ptl/templates',)

INSTALLED_APPS = (
    'django.contrib.contenttypes',
    'django.contrib.sessions',
)

除了settings.py,我的项目中没有任何其他.py文件。

我得到的错误是:

BaoxuShis-MacBook:ptl bxshi$ python manage.py syncdb
Creating tables ...
Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Library/Python/2.7/site-packages/django/contrib/contenttypes/management.py", line 11, in update_contenttypes
    content_types = list(ContentType.objects.filter(app_label=app.__name__.split('.')[-2]))
  File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 84, in __len__
    self._result_cache.extend(self._iter)
  File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 275, in iterator
    for row in compiler.results_iter():
  File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 335, in results_iter
  File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 430, in build_query
  File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 160, in add_filters
  File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 168, in add_filters
ValueError: need more than 3 values to unpack

我发现有关mongodbengine这个错误的相关内容,BBS上的一个帖子谈到了这一点,但它说已经修好了。

1 个答案:

答案 0 :(得分:1)