我的项目有什么错误? [英] What's the error in my project?

查看:140
本文介绍了我的项目有什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用mongodb作为我的python(2.7)项目与django框架。当我给
python manage.py runserver它将工作,但如果我同步db(python manage.py syncdb)以下终端中显示的错误

 创建表... 
追溯(最近的最后一次呼叫):
文件manage.py,第14行,在< module>
execute_manager(settings)
文件/usr/lib/pymodules/python2.7/django/core/management/__init__.py,第438行,在execute_manager
utility.execute()
文件/usr/lib/pymodules/python2.7/django/core/management/__init__.py,第379行,执行
self.fetch_command(子命令).run_from_argv(self.argv)
文件/usr/lib/pymodules/python2.7/django/core/management/base.py,第191行,在run_from_argv
self.execute(* args,** options .__ dict__)
文件/usr/lib/pymodules/python2.7/django/core/management/base.py,行220,执行
output = self.handle(* args,** options)
文件/usr/lib/pymodules/python2.7/django/core/management/base.py,第351行,处理
return self.handle_noargs(** options)
文件/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py,第109行,在handle_noargs
emit_post_sync_signal(created_models,verbosity,interactive,db)
文件/ usr / lib目录/ pymodules /python2.7/django/core/management/sql.py,第190行,emit_post_sync_signal
interactive = interactive,db = db)
文件/usr/lib/pymodules/python2.7/ django / dispatch / dispatcher.py,第172行,发送
response = receiver(signal = self,sender =发送者,**命名)
文件/usr/lib/pymodules/python2.7 /django/contrib/auth/management/__init__.py,第41行,在create_permissions
content_type,codename
文件/usr/lib/pymodules/python2.7/django/db /models/query.py,第107行,在_result_iter
self._fill_cache()
文件/usr/lib/pymodules/python2.7/django/db/models/query.py中,行772,在_fill_cache
self._result_cache.append(self._iter.next())
文件/usr/lib/pymodules/python2.7/django/db/models/query.py ,行959,在迭代器
for self.query.get_compiler(self.db).results_iter():
文件/usr/local/lib/python2.7/dist-packages/djangotoolbox /db/basecompiler.py,第229行,在result_iter
中为e ntity in self.build_query(fields).fetch(low_mark,high_mark):
文件/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py,第290行, build_query
query.order_by(self._get_ordering())
文件/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py,第339行,在_get_ordering
raise DatabaseError(排序不能跨越非关系后端(%s)的表)%b $ b

  django.db.utils.DatabaseError:排序不能跨越非关系后端的表(content_type__app_label)

如何解决这个问题?

解决方案

您需要使用Django-nonrel而不是Django。


I'm using mongodb for my python(2.7) project with django framework..when i give python manage.py runserver it will work but if i sync the db (python manage.py syncdb) the following error displayed in terminal

Creating tables ...  
Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)   
  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 438, in execute_manager 
    utility.execute()  
  File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)  
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)  
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/pymodules/python2.7/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/pymodules/python2.7/django/core/management/commands/syncdb.py", line 109, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/usr/lib/pymodules/python2.7/django/core/management/sql.py", line 190, in emit_post_sync_signal
    interactive=interactive, db=db)  
  File "/usr/lib/pymodules/python2.7/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)  
  File "/usr/lib/pymodules/python2.7/django/contrib/auth/management/__init__.py", line 41, in create_permissions
    "content_type", "codename"  
  File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 107, in _result_iter
    self._fill_cache()  
  File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 772, in _fill_cache
    self._result_cache.append(self._iter.next())
  File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 959, 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 229, in results_iter
    for entity in self.build_query(fields).fetch(low_mark, high_mark):
  File "/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py", line 290, in build_query
    query.order_by(self._get_ordering())
  File "/usr/local/lib/python2.7/dist-packages/djangotoolbox/db/basecompiler.py", line 339, in _get_ordering
    raise DatabaseError("Ordering can't span tables on non-relational backends (%s)" % order)

and

django.db.utils.DatabaseError: Ordering can't span tables on non-relational backends (content_type__app_label)

How to solve this problem?

解决方案

You need to use Django-nonrel instead of Django.

这篇关于我的项目有什么错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆