我完全按照本教程进行操作。尝试使用 virtualenv 多次删除和重新启动,但仍然出现错误。设置 python、mongodb 和 django 是否应该如此令人沮丧?
http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/
我尝试打电话时遇到问题
post.save()
然后我得到这个错误:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 460, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 553, in save_base
result = manager._insert(values, return_id=update_pk, using=using)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 195, in _insert
return insert_query(self.model, values, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 1436, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/query.py", line 213, in get_compiler
return connection.ops.compiler(self.compiler)(self, connection, using)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/__init__.py", line 576, in compiler
self._cache = import_module(self.compiler_module)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/marcochiang/Desktop/Development/caesarWorkflow/lib/python2.7/site-packages/django_mongodb_engine/compiler.py", line 18, in <module>
from bson.objectid import ObjectId
**ImportError: No module named bson.objectid**
请有人引导我朝着正确的方向前进。有没有更好的教程可以遵循,因为我遵循的每一个教程都会遇到错误。我即将放弃 pymongo 和 django ......