Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django MongoDB problem

my django app run with mysql, but when i try with mongodb then show thie error

Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_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 <module>
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
  File "/home/abdullah/django-trunk/django/contrib/admin/helpers.py", line 2, in <module>
    from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
  File "/home/abdullah/django-trunk/django/contrib/admin/util.py", line 1, in <module>
    from django.db import models
  File "/home/abdullah/django-trunk/django/db/__init__.py", line 27, in <module>
    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)

** I have installed all necessary module installed, but when i want to runserver then show this message

like image 347
abdullah Avatar asked Jul 31 '11 23:07

abdullah


1 Answers

I managed to fix the same error by using these packages on github:

https://github.com/django-nonrel/django-nonrel
https://github.com/django-nonrel/djangotoolbox

instead of the ones recommended on Django-Mongodb's setup page. Also, make sure to use the master branch of each, so as to not run into compatibility problems. If you're using pip, you can either pip install each of the following lines separately, or put them into your version of a requirements.txt file for your project:

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

And then run

pip install -r requirements.txt
like image 111
Herman Schaaf Avatar answered Oct 06 '22 19:10

Herman Schaaf