我的django应用程序运行mysql,但当我尝试使用mongodb然后显示该错误
Traceback (most recent call last): File "manage.py", line 14, inexecute_manager(settings) File "/home/abdullah/django-trunk/django/core/management/__init__.py", line 442, in execute_manager utility.execute() File "/home/abdullah/django-trunk/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/abdullah/django-trunk/django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/home/abdullah/django-trunk/django/core/management/base.py", line 209, in execute translation.activate('en-us') File "/home/abdullah/django-trunk/django/utils/translation/__init__.py", line 106, in activate return _trans.activate(language) File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 191, in activate _active.value = translation(language) File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 180, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/home/abdullah/django-trunk/django/utils/translation/trans_real.py", line 157, in _fetch app = import_module(appname) File "/home/abdullah/django-trunk/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/abdullah/django-trunk/django/contrib/admin/__init__.py", line 3, in from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME File "/home/abdullah/django-trunk/django/contrib/admin/helpers.py", line 2, in from django.contrib.admin.util import (flatten_fieldsets, lookup_field, File "/home/abdullah/django-trunk/django/contrib/admin/util.py", line 1, in from django.db import models File "/home/abdullah/django-trunk/django/db/__init__.py", line 27, in connection = connections[DEFAULT_DB_ALIAS] File "/home/abdullah/django-trunk/django/db/utils.py", line 82, in __getitem__ conn = backend.DatabaseWrapper(db, alias) File "/usr/local/lib/python2.6/dist-packages/django_mongodb_engine-0.4.0-py2.6.egg/django_mongodb_engine/base.py", line 87, in __init__ self.ops = DatabaseOperations(self) File "/usr/local/lib/python2.6/dist-packages/djangotoolbox-0.9.2-py2.6.egg/djangotoolbox/db/base.py", line 28, in __init__ super(NonrelDatabaseOperations, self).__init__() TypeError: __init__() takes exactly 2 arguments (1 given)
**我已经安装了所有必要的模块,但是当我想要runserver然后显示此消息
我设法通过在github上使用这些包来修复相同的错误:
https://github.com/django-nonrel/django-nonrel https://github.com/django-nonrel/djangotoolbox
而不是Django-Mongodb设置页面上推荐的那些.另外,请确保使用master
每个分支,以免遇到兼容性问题.如果您正在使用pip
,您可以pip install
单独使用以下每一行,也可以将它们放入requirements.txt
您项目的文件版本中:
git+https://github.com/django-nonrel/django-nonrel@master git+https://github.com/django-nonrel/djangotoolbox@master git+https://github.com/django-nonrel/mongodb-engine@master
然后运行
pip install -r requirements.txt