jschrewe / django-mongoadmin

Integrates mongodb into django's admin
http://www.schafproductions.com/projects/mongo-admin/
BSD 3-Clause "New" or "Revised" License
112 stars 38 forks source link

'DatabaseWrapper' object has no attribute 'Database' #26

Open yunmanger1 opened 10 years ago

yunmanger1 commented 10 years ago
-e git+git@github.com:jschrewe/django-mongoadmin.git@5d4db8d1f51db19837250f2018cfca4d25fe77e7#egg=mongoadmin-master

Getting this error, when click on "add" link

Environment:

Request Method: GET
Request URL: http://localhost:8000/wfe/admin/home/wfspec/add/

Django Version: 1.6
Python Version: 2.7.4
Installed Applications:
('django.contrib.contenttypes',
 'django.contrib.auth',
 'mongoengine.django.mongo_auth',
 'django.contrib.sessions',
 'mongoadmin',
 'django.contrib.admin',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'djcelery',
 'home',
 'django_extensions',
 'mongoengine.django.mongo_auth',
 'django_ses',
 'djangular')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django_extensions.middlewares.ForceDefaultLanguageMiddleware')

Traceback:
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  430.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  198.             return view(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  29.             return bound_func(*args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  25.                 return func(self, *args2, **kwargs2)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  338.             with self:
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/transaction.py" in __enter__
  237.             if not connection.get_autocommit():
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/backends/__init__.py" in get_autocommit
  324.         self.ensure_connection()
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/backends/__init__.py" in ensure_connection
  124.                 self.connect()
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  86.             db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)

Exception Type: AttributeError at /wfe/admin/home/wfspec/add/
Exception Value: 'DatabaseWrapper' object has no attribute 'Database'
yunmanger1 commented 10 years ago

How do you connect to mongodb? I am doing it this way

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy'
    }
}
mongoengine.connnect(dbname)
yunmanger1 commented 10 years ago

Connecting to sqlite fixes the problem

jschrewe commented 10 years ago

Yeah, any relational db will fix it. It's still a bug though, because the idea is that it works without a relational db. Still need to figure out how to call a method without calling the decorator though.