syncdb命令上的django mongo db异常

时间:2014-01-01 05:39:39

标签: django mongodb python-2.7 pymongo django-mongodb-engine

我将django 1.5.5django-mongodb-engine version 0.5.1.

一起使用

我通过以下命令安装了djangotoolbox:

sudo pip install git+https://github.com/django-nonrel/djangotoolbox

在python dist-packages中,djangotoolbox版本为1.6.2

syncdb command来电时收到此错误。

Traceback (most recent call last):
      File "/home/madmin/workspace/milkyway/apiserver/startup.py", line 57, in startup
        load_initial_data=False)
      File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 161, in call_command
        return klass.execute(*args, **defaults)
      File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 255, in execute
        output = self.handle(*args, **options)
      File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in handle
        return self.handle_noargs(**options)
      File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
        emit_post_sync_signal(created_models, verbosity, interactive, db)
      File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 195, in emit_post_sync_signal
        interactive=interactive, db=db)
      File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 170, in send
        response = receiver(signal=self, sender=sender, **named)
      File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/__init__.py", line 88, in create_permissions
        "content_type", "codename"
      File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 139, in _result_iter
        self._fill_cache()
      File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 941, in _fill_cache
        self._result_cache.append(next(self._iter))
      File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1143, in iterator
        for row in self.query.get_compiler(self.db).results_iter():
      File "/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py", line 375, in results_iter
        results = self.build_query(fields).fetch(
      File "/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py", line 482, in build_query
        query.order_by(self._get_ordering())
      File "/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py", line 543, in _get_ordering
        "non-relational backends (%s)." % order)
    DatabaseError: Ordering can't span tables on non-relational backends (content_type__app_label).

1 个答案:

答案 0 :(得分:0)

解决了。

请参阅此链接以完全卸载Django。

Uninstall Django completely

正确卸载django对于升级到新的django版本非常重要。

我再次使用django-nonrel通过以下命令进行django安装:

sudo pip install git+https://github.com/django-nonrel/django@nonrel-1.5