进入django shell并创建以下条目后:
from blinks.models import *
q=Questions(
questions='What is science?',
tags=['science','psychology']
)
我无法使用
q.save()
我收到以下错误消息
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django/db/models/base.py", line 548, in save
force_update=force_update, update_fields=update_fields)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django/db/models/base.py", line 668, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django/db/models/manager.py", line 215, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django/db/models/query.py", line 1675, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/djangotoolbox/db/basecompiler.py", line 592, in execute_sql
key = self.insert(to_insert, return_id=return_id)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/compiler.py", line 84, in wrapper
return func(*args, **kwargs)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/compiler.py", line 387, in insert
collection = self.get_collection()
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/compiler.py", line 296, in get_collection
return self.connection.get_collection(self.query.get_meta().db_table)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/base.py", line 196, in get_collection
collection = self.collection_class(self.database, name, **kwargs)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/base.py", line 204, in __getattr__
self._connect()
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/django_mongodb_engine/base.py", line 261, in _connect
self.connection = connection_class(**conn_options)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/pymongo/mongo_client.py", line 322, in __init__
username, password, dbase, opts)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/pymongo/client_options.py", line 108, in __init__
options = dict([validate(opt, val) for opt, val in iteritems(options)])
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/pymongo/common.py", line 425, in validate
value = validator(option, value)
File "/Users/sunilkumar/blink2/lib/python2.7/site-packages/pymongo/common.py", line 100, in raise_config_error
raise ConfigurationError("Unknown option %s" % (key,))
DatabaseError: Unknown option auto_start_request
我的文件夹结构如下:
/blink/
- blink
- __init__.py
- settings.py
- urls.py
- wsgi.py
- blinks (app folder)
- __init__.py
- models.py
- views.py
- tests.py
- manage.py
使用的版本是:
Python 2.7.5+
Django-1.5.11-py2.7
pymongo-3.0.1-py2.7
django_mongodb_engine-0.5.2-py2.7
djangotoolbox-1.6.2-py2.7
我有什么遗失的吗?
有人可以帮我解决问题所在吗?我是django和mongodb的新手。我无法在任何地方找到解决方案。
答案 0 :(得分:4)
我不得不将pymongo-3.0.1降级为pymongo 2.7,这解决了这个问题。此错误是因为大多数关键字已在pymongo-3.0.1中更改或弃用。
答案 1 :(得分:0)
我遇到了同样的问题。
选择自动生成的密码而不是您的密码。 这对我有用