Skip to content


Subversion checkout URL

You can clone with
Download ZIP


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

ssarangi opened this Issue · 6 comments

3 participants


I am getting this error by following the tutorial on

Could someone help with what might be going wrong.

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



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


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

Traceback (most recent call last):
  File "", line 14, in <module>
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/", line 438, in execute_manager
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/", line 379, in execute
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/", 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/", line 67, in load_command_class
    module = import_module('' % (app_name, name))
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/utils/", line 35, in import_module
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/core/management/commands/", 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/", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/home/satyajit/dev/mongo_test/local/lib/python2.7/site-packages/django/db/", line 94, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
AttributeError: 'module' object has no attribute 'DatabaseWrapper'

django-nonrel is the latest tip of tree


Can you show your


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

/Library/Python/2.7/site-packages/django/db/ 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'])

/Library/Python/2.7/site-packages/django/db/ 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'

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.