2013-11-01 40 views
1

這是我迄今所做的,無法導入名LOOK_SEP

1)我安裝的Django,並使用啓動了一個項目:

django-admin.py startproject helloworld

2)I下載django的非REL,djangotoolbox和Django的mongodb的發動機 我安裝這些使用 sudo python setup.py install

3)添加到djangotoolbox INSTALLED_APPS,並加入DJ ango_mongodb_engine作爲數據庫後端引擎。

4)我有一個樣品模型是這樣的:

5)開始蟒蛇REPL使用:python manage.py shell

6)而這樣做:

from hello.models import Post 
    post = Post.objects.create(
...  title='Hello MongoDB!', 
...  text='Just wanted to drop a note from Django. Cya!', 
...  tags=['mongodb', 'django'] 
...) 

我得到這個錯誤,我不知道如何解決這個問題

Traceback (most recent call last): 
    File "<console>", line 1, in <module> 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 149, in create 
    return self.get_query_set().create(**kwargs) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 416, in create 
    obj.save(force_insert=True, using=self.db) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 546, in save 
    force_update=force_update, update_fields=update_fields) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 650, in save_base 
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 215, in _insert 
    return insert_query(self.model, objs, fields, **kwargs) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 1675, in insert_query 
    return query.get_compiler(using=using).execute_sql(return_id) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 237, in get_compiler 
    return connection.ops.compiler(self.compiler)(self, connection, using) 
    File "/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py", line 703, in compiler 
    self._cache = import_module(self.compiler_module) 
    File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
    File "/home/home/Desktop/helloworld/django_mongodb_engine/compiler.py", line 18, in <module> 
    from djangotoolbox.db.basecompiler import (
    File "/usr/local/lib/python2.6/dist-packages/djangotoolbox-1.4.0-py2.6.egg/djangotoolbox/db/basecompiler.py", line 9, in <module> 
    from django.db.models.sql.constants import LOOKUP_SEP, MULTI, SINGLE 
ImportError: cannot import name LOOKUP_SEP 

我在這裏做錯了什麼?我如何解決它?

回答