Django MongoDB Problem

my django application starts with mysql, but when I try to use mongodb then show your 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 installed all the necessary module, but when I want to start the server, then show this message

+6
source share
1 answer

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

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

instead of those recommended on the Django-Mongodb configuration page. In addition, be sure to use the master branch for each so that there are no compatibility issues. If you use pip , you can either pip install each of the following lines separately, or put them in your version of the 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 
+9
source

Source: https://habr.com/ru/post/894000/


All Articles