Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

AttributeError: 'module' object has no attribute 'DatabaseWrapper' #144

Open
ssarangi opened this Issue · 6 comments

3 participants

@ssarangi

I am getting this error by following the tutorial on http://django-mongodb.org/topics/setup.html.

Could someone help with what might be going wrong.

db/utils.py", line 94, in getitem
conn = backend.DatabaseWrapper(db, alias)
AttributeError: 'module' object has no attribute 'DatabaseWrapper'

Thanks,

@jonashaag

Which version of Django-nonrel are you using? Also, please show the full traceback.

@ssarangi

django-nonrel was the latest git version. I will post the full traceback soon.

@ssarangi
Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/commands/dbshell.py", line 4, in <module>
    from django.db import connections, DEFAULT_DB_ALIAS
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
AttributeError: 'module' object has no attribute 'DatabaseWrapper'

django-nonrel is the latest tip of tree

@jonashaag

Can you show your settings.py:DATABASES?

@kerma

I have the same issue

In [1]: import django
In [2]: import torm.settings
In [3]: torm.settings.DATABASES
Out[3]: {'default': {'ENGINE': 'django_mongodb_engine', 'NAME': 'my_database'}}
In [4]: import os
In [5]: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "torm.settings")
Out[5]: 'torm.settings'
In [6]: django.VERSION
Out[6]: (1, 3, 1, 'final', 0)

In [7]: import django_mongodb_engine.base
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-6b6eb2c377e0> in <module>()
----> 1 import django_mongodb_engine.base

/Library/Python/2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/base.pyc in <module>()
  2 import sys
  3 from django.core.exceptions import ImproperlyConfigured
----> 4 from django.db.backends.signals import connection_created
  5 from django.conf import settings
  6 

/Library/Python/2.7/site-packages/django/db/__init__.py in <module>()
 76 # we load all these up for backwards compatibility, you should use
 77 # connections['default'] instead.
---> 78 connection = connections[DEFAULT_DB_ALIAS]
 79 backend = load_backend(connection.settings_dict['ENGINE'])
 80 

/Library/Python/2.7/site-packages/django/db/utils.py in __getitem__(self, alias)
 92         db = self.databases[alias]
 93         backend = load_backend(db['ENGINE'])
---> 94         conn = backend.DatabaseWrapper(db, alias)
 95         self._connections[alias] = conn
 96         return conn

AttributeError: 'module' object has no attribute 'DatabaseWrapper'
@kerma

Seems to be related to environment or Python 2.7. After downgrading to 2.6.7 I get the same AttributeError while trying to import django_mongodb_engine.base in python console, however Django runs fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.